You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe that multi-parameters must not be directly supported for assignable @@ functions, but
instead f(a,b,c) will be curried and synonymous for f(a)(b)(c).
An assignable @@ function must be always a function that takes a single parameter.
Thus, when presented with s.t. like:
function @@ foo(a,b,c){returna+b+c;}console.log(foo(1,2,3))// same as foo(1)(2)(3) = 6console.log(foo(1,5,3))// same as foo(1)(5)(3) = 9
The compiler, in the future, must produce the curried version of foo:
function @@ foo(a){return @@ function(b){return @@ function(c){returna+b+c;}}}
Currently it must produce a syntax error. S.t. like:
SyntaxError: examples/syntaxerror-many-parameters.js: Assignablefunctionsarerestrictedtooneparameter(2:0)1|// May be in the future this will be a synonim of foo(a)(b) but by now let us throw an error>2|function @@ foo(a,b){|^3|returna+b;4|}5|foo(a,b)=5;atParser._raise(/Users/casianorodriguezleon/campus-virtual/2324/research/parser-left-side-crguezl/packages/babel-parser/lib/index.js:705:17)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
@AdrianMoraRodriguez @PSantanaGlez13 @coromoto
I believe that multi-parameters must not be directly supported for assignable
@@
functions, butinstead
f(a,b,c)
will be curried and synonymous forf(a)(b)(c)
.An assignable
@@
function must be always a function that takes a single parameter.Thus, when presented with s.t. like:
The compiler, in the future, must produce the curried version of
foo
:Currently it must produce a syntax error. S.t. like:
Beta Was this translation helpful? Give feedback.
All reactions