|
Hello,
the current notation for block closure in typescript is quite widespread today among the different languages.. It could be interesting for some cases to simplify it...
1) no argument block
we could have
{: something to do }
instead of
()=> { something to do }
2) enabling supressing parenthesis for only one argument, or when arguments with no typing information
we could have
x:string => {: something to do }
x,y => {something to do }
instead of
(x:sting)=> { something to do }
(x,y) = { something to do }
3) enabling the following alternative notation (inspired from smalltalk or objectiveC)
{ x:string =>
.... var y = x; }
instead of
(x:string) => {
... var y = x; }
4) use the groovy convention when a block is the last argument of the function
instead of :
var xxx= dummy(var1, var2, ()=>{ .... });
var xxx= dummy(var1, var2, (x,y)=>{ .... });
being able to write :
var xxx = dummy(var1,var2) {...};
var xxx= dummy(var1, var2) { x,y => .... });
best regards
Xavier
|