A shorthand for Object.defineProperty?

Brendan Eich brendan at mozilla.com
Mon Jun 20 16:40:26 PDT 2011

On Jun 20, 2011, at 4:31 PM, Axel Rauschmayer wrote:

>>> With the shorthand for methods in object literals, there is the question whether dynamic |this| is ever needed.
>> This does not make sense.
>> Object literals used for prototypes have methods but those methods must use dynamic |this| because the calls use individual instances as their reference bases, not the prototype.
> I meant: One can already write methods (functions with dynamic |this|) in a very concise manner, thanks for Allen’s object literal extensions. Then you have to ask: Do we really need the dynamic this arrow ->, or can we make do with just the lexical this arrow =>.

We do not propose to cripple the shorter syntax. The dynamic-this use-cases for functions are at least as common as "var self=this;... function(){... self...}" use-cases for lexical this, or roughly about the same (in my experience -- anyone have data?).


More information about the es-discuss mailing list