Claus Reinke wrote:
*If* it is possible to make 'function'-free functions work, then how about dropping the implicit bindings for 'arguments' and 'this' for the short form? Then the 'function' keyword would be a modifier on the short form, to re-introduce these implicit bindings. That would support current code while connecting the semantic difference (wrt 'this') to a more visible hint than -> vs =>.This would still leave room for having both short functions and block lambdas, as they serve different uses function f(..) {..} binds 'this', binds 'arguments', binds 'return' f(..) {..} no 'this', no 'arguments', binds 'return' {|..| ..} no 'this', no 'arguments', does not bind 'return'
Three is too much. IMHO. It creates a lot less discrete border and for developer it creates lots of rules to learn and complexity in thinking. I firmly believe the middle one is not needed, and if there were only two of them, the code will be more readable (and it is very important trait; I think Brendan Eich also emphasizes this with 'freaky-deaky syntax'). I think the difference need not to as freaky-deaky (I told I like 'f_opt (params) { body }' for the first and 'f_opt (params) do { body }' for the second), but there should not be more than two forms.
Herby
(binding 'return' means that 'return' is local to this construct; not binding 'return' means that 'return' is bound non-locally, in a lexically enclosing construct). There is at least one further dimension to this (abstracting over expressions vs abstracting over statements), so there may be room/need for another construct/modifier, to get a more orthogonal design. It is part convenience, part historical accident that Javascript has 'running a block' mixed together with 'calling a callable'. Claus _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

