On Tue, Oct 29, 2013 at 3:03 PM, Brendan Eich <[email protected]> wrote:
> Axel Rauschmayer wrote: > >> 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. >> > > # is pure grawlix. It's also one of the few ASCII punctuators left, so > wanted otherwise. > > > 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. >> > > The operators stuff I've been developing uses a variant of multimethod > dispatch. > > Operators cannot be usable if spelled #add, so we must support all the > built-in ones I've talked about (see http://www.slideshare.net/** > BrendanEich/js-resp <http://www.slideshare.net/BrendanEich/js-resp>). > Whether we need element-wise operators is really what this thread is about > (I think, based on Tristan's spinout). Arbitrary infix named operators IMHO > want another thread, and also later. Design means leaving things out (N. > Wirth). > > Both operators and element-wise operators really benefit from Brendan's multiple dispatch proposal. Julia has used this approach to great effect. I'm not opposed to it, but I don't believe there's a compelling need for arbitrary infix operators in the technical computing domain. The motivation for elementwise operators is to allow for a clean matrix API that would make JS best-of-bread for numerical computing. A secondary benefit is that it could provide a cow path towards high performance BLAS backed matrix operations making it to the browser sometime far in the future. Any suitably lightweight syntax would work, although +: has some things to recommend it. Tristan
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

