Tab Atkins Jr. (2013-10-29T17:37:40.000Z)
On Tue, Oct 29, 2013 at 10:01 AM, Tristan Zajonc
<tristan at senseplatform.com> wrote:
> Following up on the discussion about operator overloading, what are viable
> options for introducing novel infix operators or a class of
> extended/prefixed operators?
>
> For motivation, I along with some others have implemented a MATLAB/R like
> environment for JS. We've written a compile-to-js language that supports,
> among other things, operator overloading and prefixed operators,  However
> we'd much prefer to follow ES6/7 and ideally avoid the need for a
> compile-to-js language entirely, at least in the future.  Without going into
> the details, prefixed operators are useful for defining objectwise and
> elementwise operations on matrices, which is a core type in technical
> computing (see Julia, MATLAB, Mata, Python PEP 225).
>
> Assuming JS allowed prefixed operators:
>
> 1. What would be the most likely syntax?  As a reference, Julia and Matlab
> use dots, a .+ b.  Stata's Mata languages uses colons, a :+ b.  PEP225
> proposes tildle a ~+ b.  R uses %infix% but this is widely viewed as a bad
> choice.  The technical community would prefer dots.  I know these prefixes
> all having meanings alone, but does .op introduce any ambiguity?  Are there
> other lightweight options?

Yes, .op is completely unusable.  "foo .bar" is identical to "foo.bar".

~TJ
domenic at domenicdenicola.com (2013-11-03T22:08:53.109Z)
On Tue, Oct 29, 2013 at 10:01 AM, Tristan Zajonc <tristan at senseplatform.com> wrote:

> 1. What would be the most likely syntax?  As a reference, Julia and Matlab
> use dots, a .+ b.  Stata's Mata languages uses colons, a :+ b.  PEP225
> proposes tildle a ~+ b.  R uses %infix% but this is widely viewed as a bad
> choice.  The technical community would prefer dots.  I know these prefixes
> all having meanings alone, but does .op introduce any ambiguity?  Are there
> other lightweight options?

Yes, .op is completely unusable.  "foo .bar" is identical to "foo.bar".