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.&nbsp; This is something I&#39;ve been meaning to ask about myself,
though.&nbsp; I&#39;ve only been using ChucK for a short time...
<br><br>As for the question on reflection... I don&#39;t think there
is anything like that there now, and somewhat doubt there will be soon... I certainly haven&#39;t seen anything
about it in the docs.&nbsp; If you want to find out, for example, if there
is a &quot;String toString()&quot; method defined for Object, perhaps the simplest
thing is to read the source code... maybe that isn&#39;t a very
constructive comment, though.&nbsp; Maybe you really do want to use reflection generally... could be useful.<br><br>Cheers,<br><font color="#888888">Peter</font><br>&lt;&lt;&lt;&quot;More text among the quote...&quot;&gt;&gt;&gt;;
<br><br><div class="gmail_quote">On Nov 9, 2007 8:50 PM, Michael Heuer &lt;<a href="mailto:heuermh@gmail.com">heuermh@gmail.com</a>&gt; 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] @=&gt; values[];<br></blockquote><div>
<br>Was this what you were after?<br>Object @ values[];<br>Object @ foo[100] @=&gt; 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> &nbsp;int value;<br>}<br><br>fun void handleEvent(Event event)<br>{<br> &nbsp;&lt;&lt;&lt; ((MyEvent) event).value &gt;&gt;&gt;;<br>}<br></blockquote><div><br>Casts are done differently, with the $ symbol. For example: 
<br>
<br>
class MyEvent {<br>
&nbsp; int value;<br>
}<br>
fun void handle(Event e){<br>
&nbsp; e $ MyEvent @=&gt; MyEvent e2;<br>
&nbsp; &lt;&lt;&lt;e2.value&gt;&gt;&gt;;<br>
}<br>
&nbsp;</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> &nbsp; michael<br></font><div><div></div><div class="Wj3C7c">
<br><br>Michael Heuer wrote:<br><br>&gt; Hello,<br>&gt;<br>&gt; I have a few chuck language questions:<br>&gt;<br>&gt; Is it possible to define a &quot;growing&quot; array? &nbsp;The associative portion<br>&gt; of the array grows without bounds but I can&#39;t see how to do that with
<br>&gt; the indexed portion.<br>&gt;<br>&gt; Object @ list[];<br>&gt; for (0 =&gt; int i; i &lt; 100; i++)<br>&gt; {<br>&gt; &nbsp; Object o @=&gt; list[i];<br>&gt; }<br>&gt;<br>&gt; Is it possible to check a reference against null?
<br>&gt;<br>&gt; Object @ list[100];<br>&gt; 0 =&gt; int size;<br>&gt; for (0 =&gt; int i; i &lt; list.cap(); i++)<br>&gt; {<br>&gt; &nbsp; if (list[i] is null?)<br>&gt; &nbsp; {<br>&gt; &nbsp; &nbsp; size++;<br>&gt; &nbsp; }<br>&gt; }<br>&gt;<br>
&gt; Is there a &quot;String toString()&quot; or similar method on Object? &nbsp;I wish to<br>&gt; override &nbsp;&quot;Expressions which represent an object will print the value<br>&gt; of that object&#39;s reference address&quot;.
<br>&gt;<br>&gt; Do reflective methods exist on the base Object type (its &quot;Class&quot;)?<br>&gt; e.g. &nbsp;Function[] getFunctions(); ...<br>&gt;<br>&gt; Thanks,<br>&gt;<br>&gt; &nbsp; &nbsp;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>