> Le 23 févr. 2015 à 21:47, Allen Wirfs-Brock <[email protected]> a écrit :
>
> Here is a new proposal for a declarative replacement for
> Function.prototype.toMethod which was dropped from ES6 earlier this year
> https://github.com/allenwb/ESideas/blob/master/dcltomethod.md
> <https://github.com/allenwb/ESideas/blob/master/dcltomethod.md>
>
> I've added this to the agenda for next months TC39 meeting but pre-meeting
> discussion is welcomed right here.
>
> Allen
>
Interestingly, two days ago I've imagined the same solution, except I was using
`.=` instead of `mixin`. The `.=` syntax is reminiscent to assignment operators
like `+=` (but, of course, it's not an operator, since its right hand side is
not a standalone expression). Reusing your examples:
```javascript
export const someMixin = obj => obj .= {
method1() {return super.method1()},
Method2() {...},
data: 42
};
```
and, for classes (but with mandatory `class`-keyword):
```javascript
C .= class {
m2() {super.m2()}
}
```
—Claude_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss