[chuck-users] Forgetting parenthesis in function calls yields noerror

Rich Caloggero rjc at mit.edu
Sat Sep 20 14:42:28 EDT 2014

What happens when you execute:

true => lisaLeft.record;

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:


However if you do something like

or <<<startRecording>>>;

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


nothing should happen – its the same as executing 


- the parser just throws it away. If the function you defined had arguments, then executing


would give you a compilation error because it expected arguments and didn’t get any.

-- Rich

From: Stefan Blixt 
Sent: Friday, September 19, 2014 5:21 PM
To: ChucK Users Mailing List 
Subject: [chuck-users] Forgetting parenthesis in function calls yields noerror

Hello list! 

I just spent a little time scratching my head over these little functions:

fun void startRecording() {
<<< "Record! ", index >>>;
true => lisaLeft.record;
true => lisaRight.record;

fun void toggle() {
!active => active;
if (active) {

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:


After that everything started working. My question is: shouldn't a function name all by itself result in an error of some kind?


Stefan Blixt

Release me, insect, or I will destroy the Cosmos! 

chuck-users mailing list
chuck-users at lists.cs.princeton.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20140920/c4c805be/attachment.html>

More information about the chuck-users mailing list