Refutable pattern

Brandon Benvie brandon at brandonbenvie.com
Fri Feb 1 11:56:55 PST 2013


Thinking about it further, I'm pretty sure the parsing looks like:

find '?', parse next expression, parse next token. If that token is ':'
then the expression is a ternary, otherwise it's a refutable expression

But if this is limited to LHS assignables then either works since the only
things allowed are identifiers or patterns.


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

> On 1 February 2013 20:00, Andreas Rossberg <rossberg at google.com> wrote:
> > On 1 February 2013 18:24, Brandon Benvie <brandon at brandonbenvie.com>
> wrote:
> >> A postfix '?' would require backtracking when the next '}' is found...I
> >> think?
> >
> > Yeah. I admit that I don't remember much of the earlier discussions on
> > respective parsing difficulties. Naively, it would seem to me that a
> > prefix '?' should actually be easier to parse.
>
> I just played with prefix '?' syntax and think it really looks nicer.
> For the time being, I changed the wiki to use that.
>
> /Andreas
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130201/8f995bdb/attachment.html>


More information about the es-discuss mailing list