Re: Avoiding overloading the term “prototype”
John J Barton
johnjbarton at johnjbarton.com
Tue Oct 23 09:47:25 PDT 2012
On Tue, Oct 23, 2012 at 8:53 AM, Brendan Eich <brendan at mozilla.org> wrote:
> I'm in the same boat. I see the attraction, very long run. Perhaps others
> will weigh in.
I guess very few developers off this list know that [[Prototype]]
exists. That is, the special double square bracket syntax is not
something developers use. Thus no change in [[Prototype]] will make an
improvement outside this list.
On the other hand, Axel's point is taken: the subject of 'prototype'
is confusing. But this is only partly terminology; much of the problem
is built in to the system. The operation of 'new' is weird, the
flexibility allowed by __proto__ is unsettling and Object.create()
completes the puzzle.
I think Axel's original post had a good suggestion: in descriptions
modify the property with its container. Consider:
An object's |__proto__| property references its constructor's
Notice I paired object with __proto__ and constructor with prototype.
Now I mangle Axel:
- prototype (of an obj): the “fallback” object, access via __proto__
- prototype (of a constructor): value of Constr.prototype
If we consistently changed documentation (MDN etc) to use "prototype
of and object" and "prototype of a constructor" perhaps the ambiguity
would be less.
(I suggest avoiding "prototype of a type" to avoid a similar issue
with the terminology for 'type').
More information about the es-discuss