Oh heck, let's just cut to the chase and hack a Chuck meta-object protocol...
Kassen:
There is some relevant code for the cast operator, chuck_type.cpp,> Andy;
>>
>> I'm not sure that's true. I just tried this:
>>
>
> You are right. I doubted for a moment because of the array and how arrays
> tend to muck with the type system but this fails too;
> JCRev foo;
> .1 => ((foo $ UGen) $ Chorus).mix;
>
>>
>> The "mix" method won't have a common location in the vtable. You might
>> get lucky casting a JCRev to a PitShift since "mix" is the first
>> method for both of them, but I certainly wouldn't count on that to
>> always work.
>
> Indeed! Turns out we just got lucky a lot of times. It does work for the
> STKInstruments and the convenience filters. I seem to remember you can also
> have it work for anything that has a .freq() but maybe there too we just got
> lucky so far.
> That's a bit disappointing; it was a nice trick while it lasted. I suppose
> it still is for those places where you can get away with it. I think I
> talked about this before, but I'd like any object to have a .type() that
> would return a array like this; ["Object", "UGen", "Filter, "LPF"]. The VM
> has all of that data, we just can't get to it.
line 2488 and related. It looks rather incomplete to me, and maybe
this is the most telling
line 2530:
// TODO: dynamic type checking
If anyone can hack together an instanceof operator from this, the
effort would be greatly appreciated. :)
michael
_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users