Axel Rauschmayer (2013-07-28T23:08:05.000Z)
1. Absolutely love the multiple dispatch stuff (slide 10).
2. A bit uneasy about typeof, which will never properly express JavaScript’s “class” hierarchy. That is bound to always confuse people (already: “wait – I thought a function was an object”, worse with value objects). But maybe it’s the best we can do. Being able to fix typeof null is awesome, though.
3. Also love that we’ll get 64 bit integers etc. (slide 11) and user-definable value objects.

W.r.t. to #1: Couldn’t we extend that to universal multiple dispatch?

const removeAll = new MultiMethod();  // not a realistic example
removeAll.addMethod(Array, Set, (arr, set) => { ... });
removeAll.addMethod(Object, Map, (obj, map) => { ... });

For the plus operator:

import { operatorPlus } from '@operators';
operatorPlus.addMethod(Point, Number, (a, b) => Point(a.x + b, a.y + b);
operatorPlus.addMethod(Number, Point, (a, b) => Point(a + b.x, a + b.y);
operatorPlus.addMethod(Point, Point, (a, b) => Point(a.x + b.x, a.y + b.y);

In my experience, multiple dispatch and single dispatch are highly complementary. Reenskaug and Coplien seem to have come to a similar conclusion (well, at least I would combine single dispatch and multiple dispatch to implement the DCI ideas):
http://www.artima.com/articles/dci_vision.html


On Jul 29, 2013, at 0:41 , Brendan Eich <brendan at mozilla.com> wrote:

> Axel Rauschmayer wrote:
>> Suggestion: put this evolving spec into a Gist or something similar.
> 
> Definitely -- trying not to work all weekend, s'all. Also practicing release-early/often on es-discuss.
> 
> Thanks for reading! Any other comments?

-- 
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/20130729/363aaa5e/attachment.html>
domenic at domenicdenicola.com (2013-08-12T05:17:49.242Z)
1. Absolutely love the multiple dispatch stuff (slide 10).
2. A bit uneasy about typeof, which will never properly express JavaScript’s “class” hierarchy. That is bound to always confuse people (already: “wait – I thought a function was an object”, worse with value objects). But maybe it’s the best we can do. Being able to fix typeof null is awesome, though.
3. Also love that we’ll get 64 bit integers etc. (slide 11) and user-definable value objects.

W.r.t. to #1: Couldn’t we extend that to universal multiple dispatch?

```js
const removeAll = new MultiMethod();  // not a realistic example
removeAll.addMethod(Array, Set, (arr, set) => { ... });

removeAll.addMethod(Object, Map, (obj, map) => { ... });
```

For the plus operator:

```js
import { operatorPlus } from '@operators';
operatorPlus.addMethod(Point, Number, (a, b) => Point(a.x + b, a.y + b);

operatorPlus.addMethod(Number, Point, (a, b) => Point(a + b.x, a + b.y);

operatorPlus.addMethod(Point, Point, (a, b) => Point(a.x + b.x, a.y + b.y);
```

In my experience, multiple dispatch and single dispatch are highly complementary. Reenskaug and Coplien seem to have come to a similar conclusion (well, at least I would combine single dispatch and multiple dispatch to implement the DCI ideas):
http://www.artima.com/articles/dci_vision.html