Novel operator syntax

Tristan Zajonc tristan at senseplatform.com
Tue Oct 29 13:18:18 PDT 2013


What about +:?  This actually has some visual appeal if primary motivation
is elementwise operations and is a syntax error with that ASI example.  The
downside is that it can end up pretty close to existing syntax like {a+:1}
vs. {a:+1}, although I don't expect that to be a common use.


On Tue, Oct 29, 2013 at 12:30 PM, Brendan Eich <brendan at mozilla.com> wrote:

> André Bargull wrote:
>
>> There are the usual ASI problems. For example this is currently valid:
>> ```
>> a
>> ~+ b
>> ```
>>
>> It is parsed as:
>> ```
>> a;
>> ~+ b;
>> ```
>>
>
> The fix we entertained for 'is' and 'isnt' was restricted productions:
>
>   AdditiveExpression [no LineTerminator here] '~+' MultiplicativeExpression
>
> But we lose backward compatibility. Probably survivable, but who knows?
> See my recent post replying to Brandon Andrews.
>
> Note this means ~+ cannot be a single lexeme in general. It has to be two,
> ~ and +, when used in the unlikely way: as unary prefix operators composed
> together.
>
> /be
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131029/7ec77092/attachment.html>


More information about the es-discuss mailing list