Hello,<br><br>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...
<br><br>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.<br><br>Cheers,<br><font color="#888888">Peter</font><br><<<"More text among the quote...">>>;
<br><br><div class="gmail_quote">On Nov 9, 2007 8:50 PM, Michael Heuer <<a href="mailto:heuermh@gmail.com">heuermh@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
If an array is defined but not instantiated with a capacity<br><br>Object @ values[];<br><br>should it be possible to instantiate it later with a capacity of nulls?<br><br>Object @ [100] @=> values[];<br></blockquote><div>
<br>Was this what you were after?<br>Object @ values[];<br>Object @ foo[100] @=> values;<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
How about a cast?<br><br>class MyEvent extends Event<br>{<br> int value;<br>}<br><br>fun void handleEvent(Event event)<br>{<br> <<< ((MyEvent) event).value >>>;<br>}<br></blockquote><div><br>Casts are done differently, with the $ symbol. For example:
<br>
<br>
class MyEvent {<br>
int value;<br>
}<br>
fun void handle(Event e){<br>
e $ MyEvent @=> MyEvent e2;<br>
<<<e2.value>>>;<br>
}<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>Thanks,<br><font color="#888888"><br> michael<br></font><div><div></div><div class="Wj3C7c">
<br><br>Michael Heuer wrote:<br><br>> Hello,<br>><br>> I have a few chuck language questions:<br>><br>> Is it possible to define a "growing" array? The associative portion<br>> of the array grows without bounds but I can't see how to do that with
<br>> the indexed portion.<br>><br>> Object @ list[];<br>> for (0 => int i; i < 100; i++)<br>> {<br>> Object o @=> list[i];<br>> }<br>><br>> Is it possible to check a reference against null?
<br>><br>> Object @ list[100];<br>> 0 => int size;<br>> for (0 => int i; i < list.cap(); i++)<br>> {<br>> if (list[i] is null?)<br>> {<br>> size++;<br>> }<br>> }<br>><br>
> Is there a "String toString()" or similar method on Object? I wish to<br>> override "Expressions which represent an object will print the value<br>> of that object's reference address".
<br>><br>> Do reflective methods exist on the base Object type (its "Class")?<br>> e.g. Function[] getFunctions(); ...<br>><br>> Thanks,<br>><br>> michael<br>_______________________________________________
<br>chuck-users mailing list<br><a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br><a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
</a><br></div></div></blockquote></div><br>