Suggestion: Infix operators/functions

2018-02-02 Thread Thomas Grainger
I'm porting this from the TypeScript issue tracker, original from: https://github.com/Microsoft/TypeScript/issues/2319#issue-60851953 Since it's very unlikely that the extension methods will ever be implemented [in a call-site-rewrite manner](https://github.com/Microsoft/TypeScript/issues/9# issue

Re: Suggestion: Infix operators/functions

2018-02-02 Thread kdex
In ECMAScript's current state, infix operators would likely complicate future discussions of operator overloading. Before we tackle these problems, I think it's more convenient to have type annotations first. On Friday, February 2, 2018 12:55:17 PM CET Thomas Grainger wrote: > I'm porting this f

Re: Suggestion: Infix operators/functions

2018-02-02 Thread Isiah Meadows
As it stands, I'd rather see operator overloading before custom operators. In order to have decent custom operators, you really have to take into account the whole grammar, and adding them in a way that's not a blatant tack on usually involves rethinking the entire grammar. In contrast, operator ov

Re: Suggestion: Infix operators/functions

2018-02-02 Thread Mike Samuel
How would this affect ASI? a // no semicolon inserted since '+' is an infix operator +b a // semicolon inserted since '!' is not an infix operator !b but what about function '!'(a, b) { ... } // now '!' is both an infix and a prefix operator a // is a semicolon i

Re: Suggestion: Infix operators/functions

2018-02-02 Thread Mike Samuel
On Fri, Feb 2, 2018 at 10:58 AM, Mike Samuel wrote: > How would this affect ASI? > > a // no semicolon inserted since '+' is an infix operator > +b > > a // semicolon inserted since '!' is not an infix operator > !b > > but what about > > function '!'(a, b) { ... } > //

Re: Suggestion: Infix operators/functions

2018-02-02 Thread Michael Haufe
How would operator precedence work? Would we be restricted to 2-argument functions only? On Fri, Feb 2, 2018 at 5:55 AM, Thomas Grainger wrote: > I'm porting this from the TypeScript issue tracker, original from: > https://github.com/Microsoft/TypeScript/issues/2319#issue-60851953 > > Since it

Re: Suggestion: Infix operators/functions

2018-02-02 Thread Naveen Chawla
I don't like the idea of custom operators only because of readability of code - it can be different for different pieces of code, and so I think it is a larger surface area for bugs, so I think it would be a net negative. However, I do like the idea of allowing e.g. `+` to be used intuitively and

Re: Suggestion: Infix operators/functions

2018-02-02 Thread kdex
People in the C++ community have been using overloaded operators since the 1980's, and I wouldn't say that different semantics for the same operator have been a bad idea at all, given that the operator handles completely different types (that can and should be statically analyzable). I wouldn't

Re: Suggestion: Infix operators/functions

2018-02-08 Thread Alexander Jones
Time to put infix operators into TypeScript, first, then? On Sat, 3 Feb 2018 at 04:25, kdex wrote: > People in the C++ community have been using overloaded operators since the > 1980's, and I wouldn't say that different semantics for the same operator > have > been a bad idea at all, given that

Re: Re: Suggestion: Infix operators/functions

2018-12-29 Thread Thiago Brevidelli
As stated in here, the TypeScript team is highly unlikely to deviate from ECMAScript’s team decisions, so I guess no infix functions in TS for now... ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss