I like it but I think I would prefer to make it explicit. Something like:

foo = foo.partial(1, ?, 2, ???, 3)

Extending it to bind when I want to do something like:

obj.foo = foo.bind(obj, 1, ?, 2, ???, 3)

WDYT?

On Thu, Apr 9, 2015 at 9:46 AM, Jussi Kalliokoski <
jussi.kallioko...@gmail.com> wrote:

> Yesterday I came up with an idea for syntactic sugar for partial
> application, introducing two new operators: placeholder (`?`) and rest
> placeholder (`???`).
>
> You can see the details in a proposal gist I made [1], but the gist of the
> gist is that you could do partial application like this:
>
> foo(1, ?, 2);
>
> or with the rest placeholder:
>
> foo(?, 1, ???);
>
> This allows for partial application at arbitrary argument indices.
>
> There's a cowpath to be paved here as well, lodash introduced placeholders
> for _.partial as of 3.0.0 [2], where you can do something similar:
>
> _.partial(foo, 1, _, 2);
> _.partial(foo, _, 1);
>
> However, the proposed syntax is even more flexible than that of lodash
> because it also allows you to have rest placeholders at arbitrary argument
> indices instead of at the end, e.g.
>
> foo(1, ???, 2);
>
> would have to be expressed with lodash as
>
> _.partialRight(_.partial(foo, 1), 2);
>
> WDYT?
>
> [1] https://gist.github.com/anonymous/5c4f6ea07ad3017d61be
> [2] https://lodash.com/docs#partial
>
> _______________________________________________
> es-discuss mailing list
> es-discuss@mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to