Strawman: partial application operator

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Strawman: partial application operator

Ben Aston
I am looking for a champion for a partial application operator strawman.

A terse, native syntax for partial application that does not affect the target of a function will improve code consistency, clarity of intent and legibility.

Assuming `arg1` is defined:

Before:

```js
import _ from 'lodash'; 
const o = {
 foo: _.partial(foo, arg1),
 bar: bar.bind(null, arg1)
};
```

After:

```js
const o = {
 foo::arg1,
 bar::arg1
};
```

I am aware of another idea entitled "this binding syntax" (https://github.com/tc39/proposal-bind-operator), that uses similar operator syntax to this strawman. I have no doubt there is a better syntax for my strawman!

Regards
Ben Aston
[hidden email]

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strawman: partial application operator

Ben Aston
Exposition here:


My apologies. I neglected to include this link in my original email.

Regards
Ben Aston

On 22 Mar 2017, at 08:15, Ben Aston <[hidden email]> wrote:

I am looking for a champion for a partial application operator strawman.

A terse, native syntax for partial application that does not affect the target of a function will improve code consistency, clarity of intent and legibility.

Assuming `arg1` is defined:

Before:

```js
import _ from 'lodash'; 
const o = {
 foo: _.partial(foo, arg1),
 bar: bar.bind(null, arg1)
};
```

After:

```js
const o = {
 foo::arg1,
 bar::arg1
};
```

I am aware of another idea entitled "this binding syntax" (https://github.com/tc39/proposal-bind-operator), that uses similar operator syntax to this strawman. I have no doubt there is a better syntax for my strawman!

Regards
Ben Aston
[hidden email]

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Strawman: partial application operator

Isiah Meadows-2
I'll invite you to check out this particular Google search, as
function binding has been discussed many different times on this list.

https://www.google.com/#safe=active&q=site:esdiscuss.org+partial+application&*
-----

Isiah Meadows
[hidden email]


On Wed, Mar 22, 2017 at 5:15 AM, Ben Aston <[hidden email]> wrote:

> Exposition here:
>
> https://gist.github.com/benaston/795b644bbbc67098ec2bd388c7060826
>
> My apologies. I neglected to include this link in my original email.
>
> Regards
> Ben Aston
>
> On 22 Mar 2017, at 08:15, Ben Aston <[hidden email]> wrote:
>
> I am looking for a champion for a partial application operator strawman.
>
> A terse, native syntax for partial application that does not affect the
> target of a function will improve code consistency, clarity of intent and
> legibility.
>
> Assuming `arg1` is defined:
>
> Before:
>
> ```js
> import _ from 'lodash';
> const o = {
>  foo: _.partial(foo, arg1),
>  bar: bar.bind(null, arg1)
> };
> ```
>
> After:
>
> ```js
> const o = {
>  foo::arg1,
>  bar::arg1
> };
> ```
>
> I am aware of another idea entitled "this binding syntax"
> (https://github.com/tc39/proposal-bind-operator), that uses similar operator
> syntax to this strawman. I have no doubt there is a better syntax for my
> strawman!
>
> Regards
> Ben Aston
> [hidden email]
>
>
> _______________________________________________
> es-discuss mailing list
> [hidden email]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Loading...