The class operator: a bridge between object and function exemplers

Brendan Eich brendan at
Mon Nov 14 17:27:09 PST 2011

On Nov 14, 2011, at 4:05 PM, Jake Verbaten <raynos2 at> wrote:

> When you create a function, it has an automatically created prototype object who has a constructor property defaulted to the original function.

Note that this unobservable mutation occurs before the function object is available to script.

> Why would it be bad to augment the UnaryExpression after the class keyword so that it has an empty constructor if it doesn't exist? 

Because UnaryExpression may evaluate to a reference to an existing object, in which the mutation of 'constructor' from not-own to defined is observable,

Mutation of operator operands apart from ++, +=, 'delete' and the like is a bad idea. Some object to .{ on this basis. 'class' unary prefix would be even more unusual.


More information about the es-discuss mailing list