[Language design] Getting rid of keywords for fun and profit
wasyl.eu
wasyl.eu
1. <call(arg1,arg2,...)> {block} => <call(arg1,arg2,...,{block})> 2. anything {block} => anything({block})
So the actual rule is that a block standing to the right of something either creates a new function call, or gets added to the existing one. The same applies to argument lists.
This means that you can do: x(1,2) {a} (3) {b}, and what happens is very regular - a function call: x(1,2,{a},3,{b}).
I know of currying, but its not used for simple calls. A solution that shares some concepts with currying was used for handling if..else, try..catch..finally and other multi-part statements.
I use [ ] as "invisible" separators, to make clear what is evaluated first, and #%If as a core version of If, perhaps programmed in another language.
In the expression
If (x<3) {console.newline;}
First, the If part is curryied [If (x<3)] => [function(x) {#%If (x<3, x)}]
And then we have [function(x) {#%If (x<3, x)}] {console.newline;}
Applying rule #2 [function(x) {#%If (x<3, x)}] ({console.newline;})
That is equivalent to #%If (x<3, {console.newline;})
I'm not sure if this approach work and handle all the corner cases.