Removing the space in `a+ +b`?

Isiah Meadows isiahmeadows at gmail.com
Thu Jul 11 18:48:15 UTC 2019


The idea is to introduce a grammar hack that notices `a++b` and
evaluates it with identical semantics to `a+ +b`. C++ used a similar
trick to allow `Foo<Bar<T>>` in addition to `Foo< Bar<T> >` for nested
template application, because it previously conflicted with `>>`. For
instance, consider `Foo<Bar<T>> name(arg);`: it used to be parsed as
`(Foo < Bar) < (T >> name(arg));`, but they made a breaking change to
make it parse as a variable declaration of type `Foo<Bar<T>>` instead,
invoking the type's constructor with `arg`. I was suggesting a similar
hack, just in this case taking advantage of something that is
currently invalid.

BTW, I'm no longer behind my suggestion, and was never strongly in
favor of it to begin with.

-----

Isiah Meadows
contact at isiahmeadows.com
www.isiahmeadows.com

On Tue, Jul 9, 2019 at 2:50 PM ViliusCreator
<viliuskubilius416 at gmail.com> wrote:
>
> Lexer already sees `++` as operator, not `+` operator**s**. It can be hard to implement something like that.
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss


More information about the es-discuss mailing list