Classes: suggestions for improvement

felix felix8a at gmail.com
Tue Jun 14 13:57:45 PDT 2011


On Tue, Jun 14, 2011 at 13:46, Bob Nystrom <rnystrom at google.com> wrote:
> On Tue, Jun 14, 2011 at 1:34 PM, felix <felix8a at gmail.com> wrote:
>>
>> > I think that's been considered before. My complaint with it is that
>> > Point
>> > isn't a prototype. It's a constructor function whose .prototype property
>> > is
>> > the prototype. In other words, the object bound to the name Point isn't
>> > the
>> > prototypical point. It's a constructor/class-thing/type-object kind of
>> > thing. It owns the Point prototype, but isn't it itself.
>>
>> Hm, by that argument "class" isn't a particularly good term either,
>> since the thing created is not a class, it's a thing that generates
>> objects that can be considered instances of a class.
>
> That's actually a pretty close definition of a class in other dynamic
> languages. In Smalltalk, Ruby, and Python, classes are objects that have
> methods to let you create instances of themselves.

Then what's the problem with calling it a "proto" instead of a
"class"?  Ok, it's not the same thing as x.prototype or x.__proto__,
but this doesn't seem to me like it would be a big source of
confusion, and it seems to me less confusing than "class" baggage.


More information about the es-discuss mailing list