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 <[email protected]> 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
[email protected]
home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss