arrow syntax unnecessary and the idea that "function" is too long

Brendan Eich brendan at
Sun May 15 14:47:12 PDT 2011

On May 15, 2011, at 1:54 PM, Dmitry A. Soshnikov wrote:

>> See last reply for more on joining. It occurs to me you thought scope chain varying in the context of a pure hash-rocket such as #->42 means that function cannot be joined, but since it is pure, it need not entrain its scope chain as an internal [[Scope]] property.
>> More, since # freezes, there's no need for it to be duplicated, since there is no mutation side channel.
>> So proposes freezing and joining, only if the user specifies via the # prefix.
> Yep, I got it, thanks, though, as mentioned seems it can be managed then at engine level without explicit specifying by the user, no?

Do you mean that users shouldn't have to write # prefixes to get joining? That is hard. SpiderMonkey implements joining for lambdas that do not close over outer lexical variables provided those lambdas are used as the initializer of a property in an object literal, or as the full RHS of assignment to a property of an Object instance. This optimization wins but it requires read and write barriers (which we already have for getters and setters in general). It's complex.

The # prefix means freeze too, and that is required for joining. ES3 left it to implementations to join but that was a mistake that (if implementations had done so; none did after early SpiderMonkey bugs were fixed) creates a mutation side channel. See also the ES3 global regexp singleton per lexical regular expression bug.


More information about the es-discuss mailing list