Swift style syntax

Dawid Szlachta dawidmj.szlachta at gmail.com
Wed Oct 14 10:50:10 UTC 2015


Hi,

Maybe it could be possible to allow operator-like characters to be included
in the methods names? Like:

Math.>

It seems clear and readable. I believe it could be parsed easily, too.
Transpilers could just change it to Math['>'].

Or, maybe allow to use some kind of new syntax (easy to parse for
transpilers), to explicitly inform the parser we want to use operator as a
function? Say:

myArray.sort(:>)

I think both propositions fix the problem Waldemar mentioned.

Cheers,
Dawid

2015-10-13 21:56 GMT+02:00 Waldemar Horwat <waldemar at google.com>:

> On 10/13/2015 10:27, Isiah Meadows wrote:
>
>> Steve, I have little problem with whatever ends up the case, as long as
>> it's shorter than `(x, y) => x + y`. The current idea was inspired by
>> Swift's `list.sort(>)` and `list.reduce(0, +)`.
>>
>
> I second the concern with this being far too full of hazards to carry its
> weight.  Let's say you allow something like the list.reduce(0, +) syntax
> for the various arithmetic operators.  Then we get to the fun ones:
>
> list.reduce(0, /) /x
>
> Oops, you've just started a regular expression.
>
>     Waldemar
>
>
> _______________________________________________
> 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/20151014/2cd5c61a/attachment-0001.html>


More information about the es-discuss mailing list