From: "David A. Black" Date: 2003-12-01T00:09:18+09:00 Subject: Re: Class-level readers and writers Hi -- On Sun, 30 Nov 2003, Christoph wrote: > > From: David A. Black [mailto:dblack@wobblini.net] > > > > I think the new incarnation of class variables might be > > handier than [I've found] the current one [to be], though > > sometimes I also wish they'd just disappear :-) I think part > > of the trouble people have with the concept of Class objects > > having instance variables is that they (wrongly but > > understandably) surmise that there must be some relation or > > connection with class variables. > > To claim that there is no connection is a bit of stretch - as > you pointed out yourself the only difference between Rite's > class variables and (today's) instance is the additional visibility > of Rite's class variables within class instances - this additional > visibility could easily achieved with accessor methods - which > has the BIG advantage that we could do without additional > Scoping rules of yet another special kind of variables (namely > class variables) reducing the overall complexity of the language. What you're describing is a similarity, not a connection :-) What I mean is that there's no interdependency, conceptually or in implementation, between class vars and class instance vars. People look for connections in trying to understand them, but they're actually best understood separately. As for the new-style class variables compares with traditional accessors defined on the Class object: the main difference I see is that the accessors are presumably callable by anyone, whereas the new class vars will be class-local (including instance method definitions). It's true that there's been a lot of demand for this; some of the class instance var confusion I've witnessed has arisen in the course of searching for exactly this, and wishing that *something* behaved this way. So it's possible that once there's a precise answer to the question of how to scope something locally to a class, the various constructs will get decoupled in people's minds and therefore easier to grasp. > This simplification might be especially welcome with the introduction > of yet another kind of variables a.k.a. ``class local variables''. I'm not sure what you meant here -- isn't that what the new class variables are going to be? David -- David A. Black dblack@wobblini.net