On Sat, 22 Sep 2007 06:58:57 -0700, Kay Schluehr wrote: > On Sep 22, 1:15 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> On Sat, 22 Sep 2007 02:44:35 -0700, Kay Schluehr wrote: >> > I checked out Io once and I disliked it. I expected Io's prototype OO >> > being just a more flexible variant of class based OO but Io couples a >> > prototype very closely to its offspring. When A produces B and A.f is >> > modified after production of B also B.f is modified. A controls the >> > state of B during the whole lifetime of B. I think parents shall not >> > do this, not in real life and also not in programming language >> > semantics. >> >> Well it's like Python: inherited slots (attributes) are looked up in the >> ancestors. It should be easy to override `Object clone` in Io, so all >> slots of the ancestor are shallow copied to the clone, but I guess this >> might break existing code. At least for your own code you could introduce >> a `realClone` slot. > > But in class based OO most relevant attributes are defined during > object construction and they can't be simply changed by setting a > class attribute. Later you often create new attributes as but on > object level. You do not overuse the object/class relationship to > broadcast changes to all objects.
You don't do this in Io either. It's really like Python in this respect. There's an `init` slot that gets called by (the default) `clone` and you set "instance attributes" there, for example mutables so they are not shared by all clones. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list