LRcurl would be the application of a Right and then a Left curly brace to a CURL expression.
Curl is proud to be LISP-like without the parentheses.
But it is sometimes less than clear how parentheses are to be interpreted in CURL.
It is clear enough how parentheses affect the application of mathematical operators.
But consider this: {let t1:int, t2:int = 42}
You may be aware that this leaves the value of t1 as zero.
So consider this: {set (t1, t2) = (1, 2)}
How are we to understand this as a CURL assignment statement?
The index to the on-line CURL documentation is resoundingly silent on the rationale for this syntax.
Set with parentheses is a fact. Is it because () is an operator?
But why should it not be the case that after {set (t1, t2) = 42} both t1 and t2 are 42 instead of this being a syntax error?
In the case of {set (t1, t2) = {my_func}} we know that the number of values returned by my_func must be two values.
You may want to guess at these values: {let t3:int, t4:int = (3,4)}
If you guessed 0 and 3, can you also tell me why this was not also a syntax error? It is enough to make my curly hair, well, curl left then right.
LcurlR
The Curl Bible (pg 190) adds a twist which is used by Paul Shaheen in his excellent Curl Enterprise Frameworks book: using parentheses to declare multiple return types for a class method or a procedure.
The interesting twist is that the identifiers in the comma-separated list are for documentation only: they are essentially comments.
Here are some return value declarations:
…}: Distance
…}:{Array-of any)
…}:(x:int, y:int, z:int)
…}:(:int, :int, :int)
Remember that declaring nothing is not declaring :void but is rather declaring :any
What I have not yet tried is
…}:null ||or
…}:#String || or
…}:#{Array-of any)
From the beginning () could be used to group arithmetic expressions as you would expect.
As you note, () was also used to group multiple lhs-variables in let/set expressions and in the syntax for declaring multiple return values.
In 4.0, () could be used to produce “tuple” values, which behave exactly the same as a function that returns multiple values, thus you can write:
set (t1, t2) = (3, 4)
or
set (t1, t2) = {multi-value-function)
In Curl, extra return values are ignored if there aren’t enough variables on the left hand side to accept them, in which case the extra return values are ignored:
set t1 = {multi-value-function} || OK
This means that you can safely add an extra return value at the end without breaking existing code.
Also note that (:int, :int) is not a legal return value specification. You cannot write ‘:’ without providing both the name and the type.
That must have been at typo for
}:(int, int, int)
( I don’t want to confess to ever using cut-n-paste