On Apr 23, 2012, at 11:17 AM, Brendan Eich wrote: > Apologies for sounding schizo. I'm saying prototypal wins at scale and I see > it more often used, but closure has its fans and it's used too. > > With both (plus other approaches such as Angus's) I do not think it's a given > that in the future, JS will make methods auto-bind |this| via prototypal > accessors. That is possible today (ES5 and earlier getter/setter support in > most browsers) and it's quite rare -- I can think of only a few cases, one of > which is in the new I18N library.
And note that the I18N usage is for a situation where the property is vending (to use Alex's term) a function that is intended to be used as a call-back that needs access to the state of the instance it was accessed from. In particular, it enables someone to say: someArray.sort(myCollator.compare) rather than someArray.sort(myCollator.compare.bind(myCollator) This seems like an important idiom hat may become even more important in the context of ES6. We probably need to encourage broader education about this idiom. But it isn't clear that it needs special syntax or even what that might be. Allen _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss