<div>
+1
</div><div><br></div><div>That sounds pretty cool!</div><div><br></div><div>It seems to indicate perhaps the concept that the { } block could really be shorthand for an unnamed function. Thus, this would also be possible:</div><div><br></div><div>{</div><div>...</div><div>} => fun void myFun;</div><div><br></div><div>or even declare here, assign there, like so:</div><div><br></div><div>fun void myFun;</div><div><br></div><div>{</div><div>…</div><div>} => myFun;</div><div><br></div><div>the issue of return types is tricky…</div><div><br></div><div>you could, like in other languages use default to void, unless the block contained a return statement:</div><div><br></div><div>{</div><div>0 => int x;</div><div>} // function returns nothing</div><div><br></div><div>{</div><div>0 => int x;</div><div>return x;</div><div>} // function returns an integer</div><div><br></div><div>Somehow I doubt that the devs would be into this… I think that this might add execution overhead and violate the principle of something-er-other.</div><div><br></div><div>But even just being able to assume that a code block could be sporked as a separate shred would be pretty awesome. Still, being able to assign the shred to a variable name would be radical. "function" is an unused reserved word, right?</div><div><br></div><div>{</div><div><<< "hi" >>>;</div><div>} => function hi;</div><div><br></div><div>spork ~ hi;</div><div><br></div><div>Awesome.</div><div><br></div><div>-Mike</div><div><br></div><div><br></div>
<div><div><br></div><div>-- </div><div>Michael Clemow</div><div><br></div><div>http://michaelclemow.com</div><div>http://abattoirprojects.com</div><div><br></div></div>
<p style="color: #A0A0A8;">On Thursday, December 6, 2012 at 8:29 PM, Tom Lieber wrote:</p>
<blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
<span><div><div>I like that alternative.<div><br><br><div>On Thu, Dec 6, 2012 at 7:26 PM, Spencer Salazar <span dir="ltr"><<a href="mailto:spencer@ccrma.stanford.edu" target="_blank">spencer@ccrma.stanford.edu</a>></span> wrote:<br><blockquote type="cite"><div>I think being able to spork a block of code like this:<div><br></div><div>spork ~ {</div><div>// some code</div><div>}</div>
<div><br></div><div>spork ~ {</div><div>// some other code</div><div>}</div><div><br></div><div>would, to a lesser but still helpful degree, alleviate the issues this proposal is trying to address. It also has the benefit of recombining existing syntax rather than introducing new syntax. </div>
<div><br></div><div>spencer</div><div><br></div><div><br><br><div><div><div>On Tue, Dec 4, 2012 at 6:58 AM, Tom Lieber <span dir="ltr"><<a href="mailto:tom@alltom.com" target="_blank">tom@alltom.com</a>></span> wrote:<br>
</div></div><blockquote type="cite"><div><div><div>So you could write this:<div><br></div><div><div> TubeBell b => dac;</div><div> ---</div>
<div> while(40::ms => now) {</div>
<div> 1 => b.noteOn;</div><div> 1600::ms => now;</div><div> 1 => b.noteOff;</div>
<div> }</div><div> ---</div><div> do {</div><div> Std.mtof(Std.rand2(0, 3) + 60) => b.freq;</div><div> } while(1640::ms => now);</div><div><br></div><div>and have it work like this:</div><div><br></div><div>
<div> TubeBell b => dac;</div><div><br></div><div> fun void part1() {</div><div> while(40::ms => now) {</div><div> 1 => b.noteOn;</div><div> 1600::ms => now;</div><div> 1 => b.noteOff;</div>
<div> }</div><div> }</div><div><br></div><div> fun void part2() {</div><div> do {</div><div> Std.mtof(Std.rand2(0, 3) + 60) => b.freq;</div><div> } while(1640::ms => now);</div><div> }</div>
<div><br></div><div> spork ~ part1();</div><div> spork ~ part2();</div><div> day => now;</div></div><span><font color="#888888"><div><br></div>-- <br>Tom Lieber<br><a href="http://AllTom.com/" target="_blank">http://AllTom.com/</a><br>
<a href="http://infinite-sketchpad.com/" target="_blank">http://infinite-sketchpad.com/</a><br>
</font></span></div>
<br></div></div>_______________________________________________<br>
chuck-dev mailing list<br>
<a href="mailto:chuck-dev@lists.cs.princeton.edu" target="_blank">chuck-dev@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-dev" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-dev</a><br>
<br></div></blockquote></div><br></div>
<br>_______________________________________________<br>
chuck-dev mailing list<br>
<a href="mailto:chuck-dev@lists.cs.princeton.edu">chuck-dev@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-dev" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-dev</a><br>
<br></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Tom Lieber<br><a href="http://AllTom.com/" target="_blank">http://AllTom.com/</a><br><a href="http://infinite-sketchpad.com/" target="_blank">http://infinite-sketchpad.com/</a><br>
</div>
</div><div><div>_______________________________________________</div><div>chuck-dev mailing list</div><div><a href="mailto:chuck-dev@lists.cs.princeton.edu">chuck-dev@lists.cs.princeton.edu</a></div><div><a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-dev">https://lists.cs.princeton.edu/mailman/listinfo/chuck-dev</a></div></div></div></span>
</blockquote>
<div>
<br>
</div>