2009/1/21 Michael Heuer <span dir="ltr"><<a href="mailto:heuermh@gmail.com">heuermh@gmail.com</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d"><br>
</div>Are you sure that doesn't work? I swear I have been doing the same<br>
with my collection classes.<br>
<br>
</blockquote><div><br>I just tested it again to make absolutely sure.<br><br>objects.popBack() returns "... :(void)" and <br><br>objects[count-1] returns something of type "object" so it seems like this is a popback issue more than something that is fundamentally impossible.<br>
</div></div><br>Below is a corrected version that does work and IMHO .popBack() can go on the bug list.<br><br>Yours,<br>Kas.<br><br>class Collection {<br> Object objects[0];<br> 0 => int count;<br><br> fun void add( Object obj ) {<br>
objects << obj;<br> count++;<br> }<br><br> // this you can't do, apparently...<br> fun Object pop() {<br> objects[count-1] @=> Object s;<br> count--;<br>
objects.size( objects.size()-1);<br> return s;<br> }<br>}<br><br>Collection myCollection;<br><br>SinOsc s;<br>Gain g;<br>Event e;<br><br>myCollection.add( s );<br>myCollection.add( g );<br>
myCollection.add( e );<br><br><<< myCollection.count >>>;<br><br>myCollection.pop() $ Event @=> Event f;<br><br>//make sure we can use it without crashing<br>f.signal();<br><<< myCollection.count >>>;<br>