Classes: suggestions for improvement
allen at wirfs-brock.com
Tue Jun 14 15:13:49 PDT 2011
On Jun 14, 2011, at 3:00 PM, Axel Rauschmayer wrote:
In the ES.next class proposal the constructor function and the prototype are simply constituents parts of a single class declaration. This definition actually turns into many objects in addition to the constructor function and the prototype. For example, there are also all the individual method function objects.
The fact that a single language construct generates multiple runtime objects isn't unusual. For example a Smalltalk class turns into a class object (roughly corresponding to the JS constructor), an instance method dictionary (roughly corresponding to the JS prototype), a metaclass object and a metaclass method dictionary (together, roughly corresponding to constructor properties), a class variable pool dictionary (roughly corresponding to any closure captured JS state that is shared by the constructor and instances), and at least one object per class or instance method.
More information about the es-discuss