operator overloading proposal

Michael Theriot michael.lee.theriot at gmail.com
Thu Jun 30 03:56:11 UTC 2016


What about extending proxies to have operator traps?

On Sun, Jun 5, 2016 at 8:22 AM, Benjamin Gruenbaum <benjamingr at gmail.com>
wrote:

> I see some discussion is happening - that's good.
>
> As I don't want to see the tremendous amount of work people put into value
> types and operator overloading go to waste - let's bring Brendan and
> Christian into this discussion and start with a link to Brendan's 2013
> slides:
>
> http://www.slideshare.net/BrendanEich/value-objects
>
> Let's consider value semantics for this.
>
> > I've been working on implementing operator overloading and would like to
> submit a proposal.
>
> > I think operator overloading would be a useful addition to the language.
> In particular I think it would be useful for defining operations on common
> mathematical object types such as complex numbers, vectors, matrices, and
> sets.
>
> > I've create a working prototype that consists of:
>
> > babel plugin that rewrites operators as function calls
> > a polyfill which defines these functions and which call the correct
> argument-specific function based on the arguments' prototypes
> > Function.defineOperator which can be used to define which function an
> operator should use for the specified types
> > "use overloading" directive which allows users to opt-in
> > More details can be found at kevinbarabash/operator-overloading. The
> babel plugin can be found at
> kevinbarabash/babel-plugin-operator-overloading. I also have a demo project
> at kevinbarabash/operator-overloading-demo.
>
> The design was inspired by some of the slides from
> www.slideshare.net/BrendanEich/js-resp.
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160629/7396557f/attachment.html>


More information about the es-discuss mailing list