Tristan Zajonc (2013-10-29T18:23:32.000Z)
On Tue, Oct 29, 2013 at 10:37 AM, Tab Atkins Jr. <jackalmage at gmail.com>wrote:

> 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".
>
>
Sorry, at most I'm only proposing every *existing* operator prefixed by .,
not new operators.  So things like
.+, ./, .*, .-., .%, .==, .!=, .>, .<, etc.  These would be called dot
operators.  This is all that's required by the
technical computing use case.

There's a question of whether to allow arbitrary operators, which would
require a new symbol obviously.  I personally don't think arbitrary
operators are worth the noise and complexity.  I'd leave this issue to
macros.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131029/f781acc1/attachment.html>
domenic at domenicdenicola.com (2013-11-03T22:09:17.028Z)
On Tue, Oct 29, 2013 at 10:37 AM, Tab Atkins Jr. <jackalmage at gmail.com>wrote:
> Yes, .op is completely unusable.  "foo .bar" is identical to "foo.bar".

Sorry, at most I'm only proposing every *existing* operator prefixed by ., not new operators.  So things like .+, ./, .*, .-., .%, .==, .!=, .>, .<, etc.  These would be called dot operators.  This is all that's required by the technical computing use case.

There's a question of whether to allow arbitrary operators, which would
require a new symbol obviously.  I personally don't think arbitrary
operators are worth the noise and complexity.  I'd leave this issue to
macros.