Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!NORUNIX.BITNET!knut-skog%rglab.uit.uninett From: knut-skog%rglab.uit.uninett@NORUNIX.BITNET (Knut Skog) Newsgroups: comp.windows.news Subject: Class vars or Instance vars Message-ID: <101*knut-skog@rglab.uit.uninett> Date: 14 Mar 89 08:04:44 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 35 Thanks to Cris (cws) and Greg @Sun for instructive comments. Gregs comment: > Now, LiteWindow has not made all the right > choices (by a long mark), so some of them can not be explained. removes my first source of confusion. Yes, I too thought that instance-vars was non-shared and class-vars was shared by all instances, however Chris' comment on composit objects as instance vars gave me a new understanding of the term non-shared. Is it right to state that class vars are shared and so is instance vars that are composite (string, array, dict, proc). Only the instance-vars that are simple objects are non-shared. To me this looks like a small problem. In object oriented system design a class should be constructed based on the true nature of the attributes of the objects under consideration. Class variations should be taken care of by subclassing and truly private data of a class instance should be defined as instance vars. The fact that class-vars is 'turned into instance vars' (placed in Instance dict) as soon as their attributs are assigned dynamicaly and therby makes it preferable to write 'natural instance attributes' as class-vars, is a pecullarity of this system that class-writers must be aware of. Right? In my 25-years as computer professional I have never had a more enjoyable and interesting experiance than NeWS. krg, Knut Skog Comp SC. Dep Univ. of Tromsoe, Norway