Jorge wrote:
If short function syntax and block lambdas are mutually exclusive, then the
block lambdas' syntax should be considered as an alternative for short function
syntax, that is, {| params | /* body */ } is a perfectly valid candidate for
short functions, without TCP.
And given that `this` is an invalid name for a parameter, to indicate a bound
this we could simply include it in the parameters list:
{|this, arg1, arg2| /* body */} bound `this`
{|arg1, arg2| /* body */} unbound `this`
I'd say other way:
{|this, arg1, arg2| ...} // unbound this (the function has its own this)
{|arg1, arg2| ...} // bound this (this is shared from outside)
---
And one more orthogonal thing to 'this' parameter: though imo not very
pretty, it is generic: it can be used to distinguish unbound/bound this
in any other new function syntax (short, TCP, etc.; if used the proposed
way, even with plain old ES5 syntax, but it seems to me contrainuitive
that one with 'this' shared this and one without 'this' has the real this)!
Herby
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss