Alexander Burger wrote: > Let me correct a wrong statement: > > On Thu, Dec 10, 2009 at 08:32:38AM +0100, Alexander Burger wrote: > >> The reason is that all inheritance mechanisms (message passing, >> lookup with 'meta', 'var:', etc) start searching one level above the >> current object. >> > > This is only true for 'meta' and derived functions, which search for a > property in the classes and superclasses of a symbol. > > In case of messages, however, the search for a method starts in the > object, and then continues in the classes and superclasses. Methods are > not stored in properties, but in an assoc list in the object's or > class's value cell. > > This was a deliberate design decision. It should be possible for an > object to override a method privately. But "class variables" (the > properties in classes and superclasses) should > > 1. really reside in classes, and > 2. not conflict with local attributes of objects > > Therefore the term (or (: name) (var: name)) must be used explicitly if > both places should be searched. >
Perhaps we should propose a naming convention, that class variables should begin with an uppercase letter, whereas instance variables should begin with a lowercase letter. So we could avoid a possible glitch where a class define an instance variable (let's say) 'id' thereby shadowing a class variable 'id'. With your proposed term above, the instance variable would silently be taken. So adhering to such a naming convention could prevent hassle ... :-) (...) Ciao, cle. -- UNSUBSCRIBE: mailto:[email protected]?subject=unsubscribe
