<HTML><HEAD>
<META content="text/html; charset=utf-8" http-equiv=Content-Type></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: 'Calibri'; COLOR: #000000">
<DIV>What happens when you execute:</DIV>
<DIV> </DIV>
<DIV>true => lisaLeft.record;</DIV>
<DIV> </DIV>
<DIV>is that you assign “"the value of true to the object property
lisaLeft.record, but because of the way the chuck operator is overloaded, this
is converted to:</DIV>
<DIV> </DIV>
<DIV>lisaLeft.record(true);</DIV>
<DIV> </DIV>
<DIV>However if you do something like</DIV>
<DIV> </DIV>
<DIV><<<listLeft.record>>>;</DIV>
<DIV>or <<<startRecording>>>;</DIV>
<DIV> </DIV>
<DIV>where “startRecording” has the value of the function you defined, then
you’ll get the address of the function object itself. So, I imagine then if you
simply execute</DIV>
<DIV> </DIV>
<DIV>startRecording;</DIV>
<DIV> </DIV>
<DIV>nothing should happen – its the same as executing </DIV>
<DIV> </DIV>
<DIV>24;</DIV>
<DIV> </DIV>
<DIV>- the parser just throws it away. If the function you defined had
arguments, then executing</DIV>
<DIV> </DIV>
<DIV>startRecording;</DIV>
<DIV> </DIV>
<DIV>would give you a compilation error because it expected arguments and didn’t
get any.</DIV>
<DIV> </DIV>
<DIV>-- Rich</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV
style='FONT-SIZE: small; TEXT-DECORATION: none; FONT-FAMILY: "Calibri"; FONT-WEIGHT: normal; COLOR: #000000; FONT-STYLE: normal; DISPLAY: inline'>
<DIV style="FONT: 10pt tahoma">
<DIV><FONT size=3 face=Calibri></FONT> </DIV>
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=stefan.blixt@gmail.com
href="mailto:stefan.blixt@gmail.com">Stefan Blixt</A> </DIV>
<DIV><B>Sent:</B> Friday, September 19, 2014 5:21 PM</DIV>
<DIV><B>To:</B> <A title=chuck-users@lists.cs.princeton.edu
href="mailto:chuck-users@lists.cs.princeton.edu">ChucK Users Mailing List</A>
</DIV>
<DIV><B>Subject:</B> [chuck-users] Forgetting parenthesis in function calls
yields noerror</DIV></DIV></DIV>
<DIV> </DIV></DIV>
<DIV
style='FONT-SIZE: small; TEXT-DECORATION: none; FONT-FAMILY: "Calibri"; FONT-WEIGHT: normal; COLOR: #000000; FONT-STYLE: normal; DISPLAY: inline'>
<DIV dir=ltr>Hello list!
<DIV> </DIV>
<DIV>I just spent a little time scratching my head over these little
functions:</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>
<DIV><SPAN style="WHITE-SPACE: pre"></SPAN>fun void startRecording() {</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"></SPAN><<< "Record! ", index
>>>;</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"></SPAN>true => lisaLeft.record;</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"></SPAN>true => lisaRight.record;</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"></SPAN>}</DIV></DIV>
<DIV> </DIV>
<DIV>
<DIV><SPAN style="WHITE-SPACE: pre"></SPAN>fun void toggle() {</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"></SPAN>!active => active;</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"></SPAN>paintActive();</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"></SPAN>if (active) {</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"></SPAN>startRecording;</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"></SPAN>}</DIV>
<DIV><SPAN style="WHITE-SPACE: pre"></SPAN>}</DIV>
<DIV> </DIV>
<DIV>Everything seemed to be in order, I added a lot of print statements, and
could for the life of me figure out why the startRecording function wasn't
executed from toggle(). There was no error message, everything seemed to be in
order. Then I peered more closely and saw that I had forgotten to put
parenthesis in the function call:</DIV>
<DIV> </DIV>
<DIV>startRecording();</DIV>
<DIV> </DIV>
<DIV>After that everything started working. My question is: shouldn't a function
name all by itself result in an error of some kind?</DIV>
<DIV> </DIV>
<DIV>Cheers,</DIV>
<DIV> </DIV>
<DIV>Stefan Blixt</DIV>
<DIV> </DIV>-- <BR>Release me, insect, or I will destroy the Cosmos!
</DIV></DIV>
<P>
<HR>
_______________________________________________<BR>chuck-users mailing
list<BR>chuck-users@lists.cs.princeton.edu<BR>https://lists.cs.princeton.edu/mailman/listinfo/chuck-users<BR></DIV></DIV></DIV></BODY></HTML>