<br><br><div><span class="gmail_quote">On 16/11/2007, <b class="gmail_sendername">Jim Hinds</b> &lt;<a href="mailto:jahbini@jahbini.org">jahbini@jahbini.org</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style=""><div>Apologies: I broke mailing list rule #1: &quot;dont use subject lines like&nbsp;Re: chuck-users Digest, Vol 28, Issue 23&quot; &nbsp;My bad.</div></div></blockquote><div><br>Erm, you did? The subject above looks perfectly fine to me, I&#39;m more concerned about why I just got this now when Gmail tells me it was send 4 hours ago but never mind, we have enough labeling and timing in ChucK already to get into those topics.
<br><br>&nbsp;</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div style="">HI. &nbsp;The function is a function. &nbsp;It is only a function and things within it (the string beep) are totally invisible to anything outside of the function definition. &nbsp;(That&#39;s only partly true as they&nbsp;theoretically&nbsp;could be passed by reference to something else, just ignore this fact for now.)
</div></blockquote><div><br>So far I&#39;m with you, yes.<br><br>&nbsp;</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div style=""> &nbsp;&#39;beep&#39; does not belong to the sporked object. &nbsp;In fact, the name &#39;tester&#39; isn&#39;t likely to be known to the sporked object.
</div></blockquote><div><br>&nbsp;</div><br><div>I&#39;m not sure here. I was/am under the impression that ChucK intentionally has a compiler and a VM that share the same address space ( <a href="http://chuck.cs.princeton.edu/doc/develop/">
http://chuck.cs.princeton.edu/doc/develop/</a> ) so we could edit it while it was running. &quot;chuck --shell&quot; should enable us to go into a shred and edit the code that&#39;s running in it.<br><br>This is quite a obscure feature, I only found out about it back then because I was using the &quot;recently edited&quot; feature of the WiKi to look for new and exciting tid-bits, let me reference this as well because it&#39;s not in the official docs to the best of my knowledge;
<br><a href="http://wiki.cs.princeton.edu/index.php/ChucK/Dev/Shell">http://wiki.cs.princeton.edu/index.php/ChucK/Dev/Shell</a><br><a href="http://wiki.cs.princeton.edu/index.php/ChucK/Dev/Shell/Examples">http://wiki.cs.princeton.edu/index.php/ChucK/Dev/Shell/Examples
</a><br><br>Oh :¬(, I just tried this again, then looked at the source for the shell and tried some more stuff and now it seems that whole page is more of a design plan then something we can do now. That would explain nicely why I never got it to work back then... :¬)
<br>&nbsp;<br>Either way, as we might spork the same function several times every resulting shred will have to have it&#39;s own &quot;beep&quot; as the content of those may change in more elaborate versions of that function. Frankly I don&#39;t see why this couldn&#39;t become a member variable of the Shred.
<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;"><div style=""><div>Chucks object and class capabilities are growing, but as they say on the street, they are not all &#39;that.&#39; &nbsp;It has to do with inheritance, namespaces, run-time magic, and lots of stuff that would kill the real-time capability of a shred. &nbsp; All these are fun problems for a computer science person, but not so very fun if you just want to make chuck sing. &nbsp;I usually just pretend that sporked things are not objects at all.
</div><div><br></div><div>A shred is more like an independent agent: a baby. &nbsp;All it knows is the function that is used to give it birth. &nbsp;That function must know how to do all the communication to and from the outside environment. &nbsp;That function can call other functions (in other classes, possibly), look at global variables (in the same source file) and such.
</div><div><br></div><div>I&#39;m sticking with global variables, at least for the short term. &nbsp;Programs in chuck are usually on the smallish side and a few global variables won&#39;t hurt the music and are just a necessary evil. &nbsp;I give those global variables useful names like &quot;second_violin_bow_velocity&quot; or some such and to keep track of them better.
</div></div></blockquote><div><br>Perhaps I should clarify that I have no real problem here. Of course global variables are fine and indeed ChucK is powerful enough that all programs end up being relatively small. I can do the equivalent of everything mentioned, for one thing the sporked function might belong to a class which would resolve the whole name space issue as every sporked shred would share the name-space of that instance of the class.
<br><br>What I&#39;m after with this investigation is mainly two things. First of all I like to poke around, see how stuff works, see if it can be abused in funny ways and generally get a deeper understanding of it all. This bit acts funny when poked so that&#39;s a encouragement to poke some more and ask questions. Maybe I&#39;m the only one but I find very large negative numbers as shred id&#39;s for non-running shreds quite remarkable.
<br><br>Secondly, and this is where it gets practical, making ChucK &quot;sing&quot; is fun and I feel I&#39;ve got a fairly firm grasp on that but changing the way in which is sings once it starts (at least in ways not necessarily anticipated at the time we told it to sing) is quite a bit harder if we don&#39;t want it to start over from scratch. I&#39;m still looking for ways to get more options there and at first this looked like a hole. Doing such things seems to me like a field on the border between &quot;theoretical issues of interest to the computer science department&quot; and &quot;making ChucK sing&quot;.
<br><br>So that&#39;s where these questions came from, I haven&#39;t gone completely silly, at least not more so then the required amount to ChucK at all :¬).<br></div><br><br>Yours,<br>Kas.<br></div>