Proposal: Placeholder operator

Sultan thysultan at gmail.com
Fri Jan 11 14:41:56 UTC 2019


>empty space with a comma?

I think that only works with trailing params. For example this is not
possible:

const foo = (a,  , c) => {}

>Today, you can write: const foo = (a, b, _) => {}

However that does throw with:

const foo = (a, _, _) => {}

>You can already write: const [ , setState] = useState(0)

Thanks i forgot about that.

On Fri, Jan 11, 2019 at 5:31 PM Claude Pache <claude.pache at gmail.com> wrote:

>
>
> > Le 11 janv. 2019 à 14:02, Sultan <thysultan at gmail.com> a écrit :
> >
> > Placeholder operator: !
> >
> > Use in function parameters(maintains arity without creating a named
> binding):
> >
> > const foo = (a, b, !) => {}
>
> Today, you can write:
>
> ```js
> const foo = (a, b, _) => { }
> ```
>
> Is the complexity added to the language worth the feature?
>
> >
> > Use in de-structuring(allows you to capture further along a tuple
> without creating a named binding):
> >
> > const [!, setState] = useState(0)
>
> You can already write:
>
> ```js
> const [ , setState] = useState(0)
> ```
>
> —Claude
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190111/48d3833b/attachment.html>


More information about the es-discuss mailing list