Kas,<br><br>No, you're not misunderstanding anything!  I got a little confused...  you can do two things with chaining in chuck.  one is a double-assignment (which is what I thought was happening):<br><br>1 => int i => int j;<br>
<br>the other is passing args to functions:<br><br>fun int foo(int i)<br>{<br>   return i+1;<br>}<br><br>1 => foo;  // returns 2<br><br>but, if we did like you suggested:<br><br>fun void bar(int b)<br>{<br>   <<< "hi", b >>>;<br>
}<br><br>then this:<br><br>1 => foo => bar;<br><br>will print "hi 2".  but what i was missing was the fact that 1 => foo returns 2 and passes that to bar.  which is different from the double assignment.  if foo didn't return an int, the above wouldn't be possible.<br>
<br>for instance, if foo was changed to this:<br><br>fun void foo(int i)<br>{<br>    //return i+1;<br>    <<< i >>>;<br>}<br><br>then the line<br><br>1 => foo => bar;<br><br>would fail with this error:<br>
<br>[Untitled 2]:line(12): argument type(s) do not match:<br>[Untitled 2]:line(12): ... for function 'bar(...)' ...<br>[Untitled 2]:line(12): ...(please check the argument types)<br><br>All I was saying originally, however, was that we should overload @=> to be able to reassign functions themselves to other references.<br>
<br>fun void foo(int i)<br>{<br>   <<< i >>>;<br>}<br><br>foo @=> fun void foo2;<br><br>1 => foo2;  // prints 1<br><br><br>Sorry about the confusion--I think we agree, I'm just being lazy in my explanations.  ;-)  all work and no play makes mike a dull boy.  all work and no play...<br>
<br>Abort, Retry, Fail,<br>Mike<br><br>:)<br><div class="gmail_quote">2010/1/11 Kassen <span dir="ltr"><<a href="mailto:signal.automatique@gmail.com">signal.automatique@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="gmail_quote"><div><br></div><div>Mike</div><div class="im"><div><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">1 => foo;<br>
<br>this is sane,</blockquote><div>
<br></div></div><div>Agreed.</div><div class="im"><div> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> but this isn't:<br><br>1 => foo => bar;<br>
<br>foo(1) is the same as 1 => foo<br>
<br>foo => bar is the same as bar(foo)<br><br></blockquote><div><br></div></div><div>Yes... But look at this;</div><div><br></div><div>60 => Std.mtof => my_osc.freq;</div><div><br></div><div>That's good ChucKian form, I'd say. It's compact, it's coherent and it's very readable, almost like a chronological sentence, like "I put on my coat and went outside"</div>
<div class="im">
<div><br></div><div> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">however, I was suggesting that I could assign the object/function foo to reference bar this way:<br>


<br>foo @=> bar;<br><br>which means this:<br><br>1 => bar;<br><br>would now return 3 because bar is now a reference to the same function foo is a reference to.<br><br>see what I mean?<br><br></blockquote><div><br></div>

</div><div>Yes, I do, but when functions become objects then the code becomes ambiguous for overloaded to take both functions and integers as parameters. If my_osc.freq above would be overloaded to also take functions as a argument then that line become a bit like "I was walking my dog when I met a girl, then I brushed her hair.". That sentence might mean I brushed my dog or I might have brushed the girl's hair. You and me would probably never use a sentence like that because it's asking for misunderstandings, but it's perfectly fine English. Formal languages should really not have that sort of sentence, I feel, and I don't see how we can get around this with your plan as it stands.</div>

<div> </div><div>I'm certainly not saying here that I think functions as objects or as arguments are inherently a bad idea, in fact I think it might be a very good one. As it stands, though, I think your proposal has some issues and I wouldn't like to break or lovely feature of chaining function-calls into single lines of code where that makes sense.</div>

<div><br></div><div>Are we on the same page again? Am I still misunderstanding something?</div><div><br></div><div>Yours,</div><div>Kas.</div></div>
<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>
<br></blockquote></div><br><br clear="all"><br>-- <br><a href="http://michaelclemow.com">http://michaelclemow.com</a><br><a href="http://semiotech.org">http://semiotech.org</a><br><br>