[chuck-users] determining the type of an Object in code

mike clemow gelfmuse at gmail.com
Wed Feb 11 00:03:50 EST 2009


Hi Tom,

Github, yes.  The fork is here:

http://github.com/clembie/mc_chuck_dev/

I may make some other modifications.  I'll publish those as well.  The
v2 folder is where you should build from.

If getType() was stubbed out, then my guess is that we shouldn't mess
with it.  Perhaps we should change the name of this method to
something else.  getClass() maybe...

-Mike

On Tue, Feb 10, 2009 at 10:25 PM, Tom Lieber <lieber at princeton.edu> wrote:
> 2009/2/10 mike clemow <gelfmuse at gmail.com>:
>> I recently pulled from CVS and started fooling around and discovered a
>> remarkably simple hack.  There's a method in Object, toString(), which
>> returns a string containing the class of the object as well as the
>> reference ID.  Like this (supposing a class called "Test"):
>>
>> "Test:11ceff0"
>>
>> There's also a stub in chuck_lang.cpp for a method getType(), which
>> isn't implemented (yet).  So, I copied the implementation of
>> toString(), minus the printing of the reference ID, and placed it
>> where the implementation of getType() should be.  Now all objects (not
>> UGens yet, although that would be sweet) respond to getType().
>
> Haha, awesome! I guess if getType() is going to be something different
> you're a little screwed, but an interesting solution.
>
> Do you have a GitHub account to publish this in a fork with? Not
> necessary, but even if you just clone it locally and make a branch on
> your computer, then it'll be easier to maintain the change as versions
> go by.
>
> --
> Tom Lieber
> http://AllTom.com/
> _______________________________________________
> 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