Hey,
Mike, your suggestion sounds great. I look forward to hearing more about it.
Kassen, thanks for the info. My german name was given to me in Venezuela,
where I was born. I have not german family whatsoever. I am half
venezuelan, half spanish, currently leaving in NY. Here I met my fiancée, a
japanese lady I have been living with for the last four years. I use more
chopsticks than fork and knife these days
*
*
*C'est la vie ;)*
On Mon, Dec 24, 2012 at 3:03 PM, mike clemow
Hey Wolfgang, Kas,
So, a few years ago I wanted the same thing for intelligent casting purposes. Instances of Object type respond to the method toString() as well as typeOf(), a stubbed out method in Object source code with no implementation.
My solution was modify the implementation of toString() to only return the class name and inserted that into the stub for typeOf().
After recompilation, I could call typeOf() on instances (or instances of subclasses of) Object and get a string representation of that object's type.
I can be more specific about the change and the files involved when I get back to my home after the holidays (Wednesday).
Hope this helps! It's an easy change.
-mike
//-- Sent from my Tracking Device. --//
On Dec 24, 2012, at 6:40 AM, Kassen
wrote: On Sun, Dec 23, 2012 at 03:45:45PM -0500, Wolfgang Gil wrote:
Hello chuckers
Hey Wolfgang!
I am looking for a reference to the 'string' object class in chuck. I am having a hard time trying to guess what methods are available for the class.
Sorry, but String is not a class, it is a primitive. Ok, it is a bit unusual primitive that sometimes acts a bit differently from int, float, dur, etc, but as far as I can remember those differences are bugs. String should be a primitive with all of the advantages (automatic instantiation) and all of the downsides (no member functions) of those.
This is talking from the ChucK side, in the C++ source things might be different; I never looked at that part of the source.
I also recently came across with the StringTokenizer object but it seems to work only when the token is a white space. Is it possible to assign a different token to the object?
Sadly no, not that I know of. Do we need that?
What gets printed is the object's type plus what I believe is a reference to memory that I am currently not interested in, separated by a colon ( TriOsc:1001f36a0)
Way cool! I've long wanted this. Could I suggest a way to get a array of types in hierarchy? That way we could get something like;
["Object", "UGen", "StkInstrument", "Sitar"] //it's all of those
or;
["float"] //floats are clearly not objects, even is strings are weird.
That would be a great help when working with groups of objects that have some things in common and not others. If, for examplle, we'd just want a egg we could simply check whether the object is a "bird" and thus would support .getEgg(), we might not be interested in whether it has more detailed functions like .getBlueFeather() . In some cases that might save a lot of checks and clean stuff up a lot. I don't like big trees of IF's.
Currently that is mostly relevant for the StkInstrument series and the Filter one, but I could see more sets like that and of course it would make sense for our own class hierarchies.
Happy holidays!
You too! Don't let my modest proposals keep you away from this choice reason to spend time with loved ones and food. There is probably some rule against suggesting more work on Dec.24th to people with European names. Sorry ;-)
Yours, Kas. _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
-- http://www.wolfganggil.com http://www.wolfganggil.com/about