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

mike clemow gelfmuse at gmail.com
Wed Jan 21 16:27:58 EST 2009


Yeah, that must be it.  Michael must not use popBack() method in his
classes.  This...

fun Object at( int i ) {
	return objs[i];
}

...properly returns an Object.

So, does that qualify as a bug in popBack() 's implementation?

-Mike


On Wed, Jan 21, 2009 at 3:49 PM, Kassen <signal.automatique at gmail.com> wrote:
> Mike;
>
>> 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;
> <<<foo>>>;
> <<<bar>>>;
>
> Clearly the info is there already.
>
> Yours,
> Kas.
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>



-- 
http://michaelclemow.com
http://semiotech.org


More information about the chuck-users mailing list