A copy vs. the original prototyp in global slots
thorsten.dittmar at daedalos.com
Wed May 15 15:40:52 UTC 2002
I have another question. When you have an object, like the dictionary in
globals with a slot like values (a vector) in this global, then normally not
the global vector is in this slot, it is a copy of this global vector. So
when you make then a copy of this dictionary, a more or less deep copy is
made (values and keys are copied too).
In my understanding it would be much better to use the global vector because
then all the chances that I would make for the vector (new data slots) were
immediately available. I know normally nobody has to chance a system object
but the problem is the same for other "complex" objects.
So I ask me what is the reason for that:
- it is not the excepted behaviour that changes on the global vector have
any impact on the one that is used in the dictionary - but behaviour changes
have still an impact because they are made in the parent of this vector.
- when somebody is changing this vector (by inspecting and manipulating it)
the global one would be changed. This would be a good reason, but it seams
to me, that for this problem this is not the right solution. If we want to
prevent this it would be much better to make global objects more or less
So why don't we use for slots in prototypes the excepted prototype instead
of a copy of them?
More information about the Self-interest