[chuck-users] parent and children classes (I meant polymorphism)

Kassen signal.automatique at gmail.com
Wed Jan 21 15:49:15 EST 2009


Man, that sounds familiar...  ;-)

I thought it might....

       // this you can't do, apparently...
>        fun Object pop() {
>                //objects.popBack() @=> Object s;
>                //return s;
>        }

Actually it seems like objects.popBack() will return something of type void.
Sounds like another case of arrays mucking with the type system to me.

I don't think the type system would be that bad if it weren't for stuff like
that. Arrays seem to somehow lose some of the type of some objects at times.

> I really wish that there was at least an isInstanceOf() method (like
> in Java, sadly), we could use to programatically determine the class
> of an object at runtime.  It's my personal, humble opinion that, if
> you're going to have a strict typing system, you should provide a way
> to programatically determine the type of anything.

This sounds like a very good idea to me. At the very least it should make
debugging situations like the one you have here much easier. Right now I
tend to simply print objects to determine their type;

SinOsc foo;
Event bar;

Clearly the info is there already.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20090121/ac9caaa0/attachment.html>

More information about the chuck-users mailing list