Classes: suggestions for improvement

Axel Rauschmayer axel at
Mon Jun 13 01:55:56 PDT 2011

Excellent points, thanks! Wasn’t aware that Smalltalk did duck typing, but it must make things much more generic.

Note: IIRC, Self calls its prototypical instances “prototypes”. What JavaScript calls a prototype (both the relation and the objects forming the right-hand sides of such a relation) is called a parent in Self. But that does not affect your arguments.

> The correspondence is not quite that straight forward.  A prototype P, as used in self, does seem to frequently subsume the role of a class.  A constructor  generally corresponds to the copy method of such a prototype.

Isn’t that the illusion that class literals aim to create? That a class is actually a single construct, an object C with a method construct() and that you can apply the new operator to that object? new C(x,y) would perform the following steps:

- Create a new instance o whose prototype is C.
- Invoke o.construct(x,y)

Maybe "initialize" would be a better name than "construct", then.

Couldn’t that illusion be turned into how things are actually done?

Dr. Axel Rauschmayer

axel at


More information about the es-discuss mailing list