<br><br><div><span class="gmail_quote">On 3/13/07, <b class="gmail_sendername">David Powers</b> <<a href="mailto:cyborgk@gmail.com">cyborgk@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>I could be wrong, but I think you do the following:<br>1. Give the class a reset method<br>2. Every time you create an instance, add the instance to an array<br>3. To reset, run your reset method on all instances contained in the array
</blockquote><div><br>Yes, that's exactly what it comes down to. <br><br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">A more automated way, though I'm not entirely sure if/how it would
<br>work in ChucK:<br>1. Give the class a reset method<br>2. Give the class a static array property<br>3. In the class initialization code, add objects to the static array<br>when they are initialized</blockquote><div><br>
Right! This would be by asigning "this" (the keyword) to the array at the first location that's not yet used, right? We'd simply make the array quite large to have headroom for later growth.<br><br> </div>
<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">4. Add a static reset method, that runs the object reset method from<br>(1) on each instance of the static array.
<br>5. Run the static reset method to reset everything while you are ChucK-ing..<br><br>***Warning: most OOP I do is in Flash Actionscript 2.0 right now,<br>which is far from a good programming language. Take this with a grain
<br>of salt, but it should theoretically work to the best of my knowledge.</blockquote><div><br><br>No, as far as I understand it now that would work fine and it's actually quite clever and clean, I think. I think I'll use this method, it will also make what I'm doing now far easier to extend without having to manually keep house in some arbitrary spot. I don't like it when things that are that important to the overall stability have no clear place in the program.
<br></div><br><br>Thanks!<br><br>Kas.<br></div>