On Thu, Apr 9, 2015 at 4:04 PM, liorean <[email protected]> wrote:

> Do we really need it?
> Your «foo(1, ?, 2);» is equivalent to «a=>foo(1,a,2)».
> Your «foo(?, 1, ???);» is equivalent to «(a,...b)=>foo(a,1,...b)».
> Your «foo(1, ???, 2);» is equivalent to «(...a)=>foo(...[1,...a,2])».
>

Not exactly. Using the placeholder syntax, `this` remains context
dependent, whereas with your examples you get `null` as `this`.

This might not seem like such a big deal until you consider it in
combination with the proposed bind syntax [1].

Also in your examples, redefining `foo` will lead to different results. The
placeholder syntax has a lot more room for optimization in the JIT compiler
(the partially applied result is guaranteed to have no side effects for
example, so the compiler can create a version of the original function
where it can inline the specified arguments; less moving parts, easier to
optimize).

[1] http://wiki.ecmascript.org/doku.php?id=strawman:bind_operator



> Also, the ? token is already taken by the ternary conditional
> operator. Do we really want to overload it here for a nullary
> operator/special form, when we have as low overhead syntax as we
> already do in fat arrows for doing the exact same thing?
> --
> David "liorean" Andersson
> _______________________________________________
> 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

Reply via email to