[chuck-users] re Instanceof in ChucK
Casper Schipper
casper.schipper at gmail.com
Fri Oct 31 12:24:33 EDT 2014
Ah sorry Will, I misread your question.
I am afraid that there is no built-in way in ChucK to check what is the super-class of an object.
However, you could take a look at this earlier discussion which discusses the same problem:
https://lists.cs.princeton.edu/pipermail/chuck-users/2013-January/007223.html
best,
Casper
> On 31 okt. 2014, at 17:09, Casper Schipper <casper.schipper at gmail.com> wrote:
>
> Try .toString(): it's the closest thing.
>
> SinOsc foo;
> Object bar;
>
> class MyClass {
> float value;
> }
>
> MyClass myInstance;
>
> <<<foo.toString()>>>;
> <<<bar.toString()>>>;
> <<<myInstance.toString()>>>;
>
>
> "SinOsc:10061d9a0" : (string)
> "Object:61000009e190" : (string)
> "MyClass:61000009e140" : (string)
>
> Best,
> Casper
>
>
>>
>> 1. Instanceof in ChucK (Will Hardwick-Smith)
>>
>> From: Will Hardwick-Smith <whardwicksmith at gmail.com <mailto:whardwicksmith at gmail.com>>
>> To: chuck-users at lists.cs.princeton.edu <mailto:chuck-users at lists.cs.princeton.edu>
>> Date: 30 oktober 2014 23:34:57 CET
>> Reply-To: ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu <mailto:chuck-users at lists.cs.princeton.edu>>
>> Subject: [chuck-users] Instanceof in ChucK
>>
>>
>> Say I have Object o, and I want to see if it is an instance of UGen or a sub-class of UGen.
>> Is there a way to check this in ChucK?
>>
>>
>> _______________________________________________
>> chuck-users mailing list
>> chuck-users at lists.cs.princeton.edu <mailto:chuck-users at lists.cs.princeton.edu>
>> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20141031/aecce82b/attachment.html>
More information about the chuck-users
mailing list