[chuck-users] Intraspection - an example of what I'm attempting
signal.automatique at gmail.com
Tue Nov 9 13:43:15 EST 2010
On 9 November 2010 19:27, Andrew Turley <aturley at acm.org> wrote:
> Just to be contrarian here, I would like to point out that
> "instanceof" and run-time type checking are generally considered a bad
> idea in OO languages. Take a look at these to start:
> http://www.artima.com/intv/constP.html (see the section "When to Use
I take it that by OO -here- you mean languages like C++ and Java, and not
something like Scheme which is extremely OO (functions and primitives are
objects there too, unlike in ChucK).
If so, and I'm not terribly misunderstanding something, then yes, it
probably is... but then those languages are typically used in a context of
writing code, compiling it and having a executable. Compared to them we are
relatively focussed on adding to a running program and editing it, something
that is typically used in very different sorts of languages.
> Maybe you could argue that for quick scripts the benefits outweigh the
> problems, but I think I would look harder for an OO solution. Granted,
> Chuck has somewhat limited support for OO, so maybe we just don't have
> the tools we need for a better solution (multiple-inheritance [also
> problematic], dynamic dispatch, type-safe downcasts, interfaces, etc).
> I'm not trying to make the great the enemy of the good here, I'm just
> saying that there might be better ways of solving this problem, at
> least from a software engineering standpoint.
I'd be very enthusiastic about a better solution to the issue; I just made
some stuff up that sounded convenient. One of the things that affects this
and that affects livecoding is the namespace which much of the time gets in
our way. If there are other ways of determining the nature of some object we
wouldn't need to do this.... Or we could have some sort of way that would
allow us to try doing things to objects where we are unsure of their
capabilities and not have the whole thing come crashing down.
I'm not too attached to the proposed solution, any other way of dealing with
the problem would also be fine.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the chuck-users