On Aug 20, 2014, at 7:30 PM, Andrea Giammarchi wrote: > I like the `Function.prototype.new` hint but unless it's an implicitly > self bound method you still cannot easily pass it around as callback > for a map without binding it all over. > > `arr.map(MyClass.new)` without needing to explicitly bind it each time > is needed/used would be an exception, but probably a good one.
true, but you can write: arr.map((...a)=>new Map(...a)); or define: Object.assign(Function.prototype, { get asFactory() {return (...args)=>new this(...args)} } so you can say: arr.map(MyClass.asFactory) Allen _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss