J
John G Harris
Joost Diepenmaat wrote:
No, it is _not_ expected at all that two objects derived from the same
prototype share their property *values*.
Objects don't 'derive' from the same prototype object, they share it.
The very point about objects
is that they have identity, that they *differ* from each other.
In C++ and Java two objects can share the same class-static data; they
only differ in the non-static data. Javascript has something similar; it
allows data to be shared as long as it isn't written to, and allows
functions to be shared for calling.
<snip>I'm afraid you are in error here. Prototypes are objects in their
own right, but the term "prototype", translatable at least into all
Indo-European languages, including Nederlands if I may say so, has
the meaning of "template". In engineering, a working prototype is
the first thing you need to make a series of machines with similar
functionality and properties. Note that since the words are not
being used in the OOP sense here, the connection is most obvious.
Perhaps you've never visited one of the prototype Concordes. They aren't
'templates'; they're real aeroplanes that flew. (Very fast).
More to the point, the ECMAScript standard defines it's use of the word
'prototype' (Section 4.3.5, for instance). That's what it means in the
standard whatever you might like and whatever an external dictionary or
encyclopaedia says.
You'll be unhappy to hear that the C standard defines 'prototype' to
mean a piece of text like
int f(int a, int b);
John