Axel Rauschmayer (2013-10-29T21:55:11.000Z)
I would love to have a way to write function calls infix. That may cover your use case as well. That is (strawman syntax):

    arg1 #func arg2

would be syntactic sugar for

   func(arg1, arg2)

Advantages: more versatile, less grawlixy. Problem: would make much more sense with multiple dispatch (dynamic dispatch over the arguments), but that doesn’t seem to be in the cards for JavaScript.

On 30 Oct 2013, at 4:01 , 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?
> 
> 2. Is there a preferred class literal syntax?  I believe the proposed value object syntax would be perfect if extended to classes as well.
> 
> 3. Can this be done prior to macros?  It may be my narrow matrix centered view, but I do not believe there's a compelling need for arbitrary infix operators in technical computing if it introduces additional difficulties.
> 
> With ES6 and these operators I believe JS/NodeJS could easily take over the technical and statistical computing domains.
> 
> Tristan

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131030/ff039cd1/attachment.html>
domenic at domenicdenicola.com (2013-11-03T22:11:49.610Z)
I would love to have a way to write function calls infix. That may cover your use case as well. That is (strawman syntax):

    arg1 #func arg2

would be syntactic sugar for

    func(arg1, arg2)

Advantages: more versatile, less grawlixy. Problem: would make much more sense with multiple dispatch (dynamic dispatch over the arguments), but that doesn’t seem to be in the cards for JavaScript.