Hello,
AFAIK there is no mechanism to alter the capacity of an array, and at
present not much else in the way of handy data structures. This is
something I've been meaning to ask about myself, though. I've only been
using ChucK for a short time...
As for the question on reflection... I don't think there is anything like
that there now, and somewhat doubt there will be soon... I certainly haven't
seen anything about it in the docs. If you want to find out, for example,
if there is a "String toString()" method defined for Object, perhaps the
simplest thing is to read the source code... maybe that isn't a very
constructive comment, though. Maybe you really do want to use reflection
generally... could be useful.
Cheers,
Peter
<<<"More text among the quote...">>>;
On Nov 9, 2007 8:50 PM, Michael Heuer
If an array is defined but not instantiated with a capacity
Object @ values[];
should it be possible to instantiate it later with a capacity of nulls?
Object @ [100] @=> values[];
Was this what you were after? Object @ values[]; Object @ foo[100] @=> values; How about a cast?
class MyEvent extends Event { int value; }
fun void handleEvent(Event event) { <<< ((MyEvent) event).value >>>; }
Casts are done differently, with the $ symbol. For example:
class MyEvent {
int value;
}
fun void handle(Event e){
e $ MyEvent @=> MyEvent e2;
<<
Thanks,
michael
Michael Heuer wrote:
Hello,
I have a few chuck language questions:
Is it possible to define a "growing" array? The associative portion of the array grows without bounds but I can't see how to do that with the indexed portion.
Object @ list[]; for (0 => int i; i < 100; i++) { Object o @=> list[i]; }
Is it possible to check a reference against null?
Object @ list[100]; 0 => int size; for (0 => int i; i < list.cap(); i++) { if (list[i] is null?) { size++; } }
Is there a "String toString()" or similar method on Object? I wish to override "Expressions which represent an object will print the value of that object's reference address".
Do reflective methods exist on the base Object type (its "Class")? e.g. Function[] getFunctions(); ...
Thanks,
michael
chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users