Refutable pattern

Brandon Benvie brandon at brandonbenvie.com
Fri Feb 1 09:24:10 PST 2013


A postfix '?' would require backtracking when the next '}' is found...I
think?


On Fri, Feb 1, 2013 at 12:21 PM, Andreas Rossberg <rossberg at google.com>wrote:

> On 1 February 2013 10:56, Axel Rauschmayer <axel at rauschma.de> wrote:
> > Beautiful.
> >
> > What do question marks in value (as opposed to key) positions mean?
> > Example: { a: x? }
>
> Not much: a plain identifier 'x' is always matches anyway, i.e. is
> already irrefutable, so wrapping a '?' around it does not have any
> effect (it's like writing "if (true)" or whatever). I removed the
> redundant example.
>
>
> > How does this work grammatically (ternary operator…)?
>
> That still has to be worked out. I'd actually prefer a prefixed ?,
> since it is quite easy to overlook a postfix one trailing a longish
> pattern when reading code. But that may be more difficult to reconcile
> with the existing syntax.
>
> /Andreas
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130201/46154969/attachment-0001.html>


More information about the es-discuss mailing list