One of my fustrations in using Smalltalk is that I may have a subclass B with a number<br>of subclasses,&nbsp; say&nbsp; C,D,E,F &nbsp; and such that some of the subclasses, say C and D, <br>need to access an instance variable, say&nbsp; b,&nbsp; but the remainding classes,&nbsp; say E and F, 
<br>do not need to access variable&nbsp; b.&nbsp; In this situation I have two basic options:<br><br>1)&nbsp; Declare variable b in&nbsp; class&nbsp; B.<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The problem then is&nbsp; space is allocated for variable b in&nbsp; classes&nbsp; D and E as well.
<br><br>2)&nbsp; Declare variable&nbsp; b&nbsp;&nbsp; in classes&nbsp; C&nbsp; and&nbsp; D.<br>&nbsp;&nbsp;&nbsp;&nbsp; A minor problem here is that I need to declare b for each class <br>&nbsp;&nbsp;&nbsp;&nbsp; which uses&nbsp; b&nbsp; rather than just once.<br>&nbsp;&nbsp;&nbsp;&nbsp; The major problem is that methods that access&nbsp; b&nbsp;&nbsp; must be written&nbsp; in each class
<br>&nbsp;&nbsp;&nbsp;&nbsp; that uses&nbsp; b,&nbsp; while if option 1) is used, the methods need be declared only in class B.<br>&nbsp;&nbsp;&nbsp;&nbsp; (Admitted this causes the methods to be accessible by classes&nbsp; D and E as well <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; which is not desirable but is usually acceptable.)
<br><br>I propose that Smalltalk (Squeak) allow the declaration of abstract variables as follows:<br><br>A line of the form&nbsp; abstractInstanceVariableNames: 'b c'&nbsp; in the definition of the<br>variables of the class&nbsp; B would declare&nbsp; b (and c)&nbsp; as abstract instance variables.&nbsp; 
<br>(The same approach would be applied for class variables.)<br>No space is allocated for&nbsp; variable b&nbsp; so instances of&nbsp; B could not access them.<br>Nevertheless it would then be possible to write methods of class B&nbsp; that accessed
<br>variable&nbsp; b.&nbsp;&nbsp; Let&nbsp; M&nbsp; be method of&nbsp; B&nbsp; that accesses b (but not&nbsp; c).<br>Alas, instances of&nbsp; B&nbsp; cannot use method&nbsp; M since M is an abstract method.<br>(Abstract methods are methods that access abstract instance variables)
<br><br>Now, in subclasses of&nbsp; B,&nbsp; it is allowable to define instance variable&nbsp; b.<br>Once this is done method&nbsp; M&nbsp; becomes accessible <br>to the instances of the subclasses of&nbsp; B&nbsp; for which&nbsp; b&nbsp; has been declared.&nbsp; <br>For example if&nbsp; classes&nbsp; C&nbsp; and&nbsp; D&nbsp; declare&nbsp; instance variable b
<br>while classes&nbsp; E&nbsp; and&nbsp; F&nbsp; do not then&nbsp; instances of classes&nbsp; C&nbsp; and&nbsp; D&nbsp; <br>can use method&nbsp; M&nbsp; but instances of classes&nbsp; E and F&nbsp; cannot use method&nbsp; M.<br><br>In terms of implementation it should be noted that the byte codes for&nbsp; M&nbsp; are
<br>not connected to class B&nbsp; but instead two copies of the byte codes for&nbsp; M are created<br>with one placed with&nbsp; class&nbsp; C and the other placed with class&nbsp; D.<br>The bad side of this is obviously the duplication of code.&nbsp; This is no worse than
<br>Option 2) however, and is in fact better since only one copy of the source is created.<br>Option 1) remains in circumstances where it is warranted.<br><br>It is noteworthy, also, that access to method&nbsp; M&nbsp; is faster than with Option&nbsp; 1) because
<br>less searching of the inheritance chain is needed to find&nbsp; M.&nbsp; This presents a problem:<br>Users wanting fast access to a method N&nbsp; of&nbsp; B that is not abstract by subclasses of&nbsp; B<br>could artificially make&nbsp; N&nbsp; abstract by having it access b&nbsp; as in
<br>&nbsp; &nbsp; &nbsp; 'true ifFalse:&nbsp; [b &lt;- b].'. <br>This is ugly of course.&nbsp; What is needed is a way to define a method,&nbsp; say&nbsp; Q,&nbsp; of&nbsp; B<br>as abstract even though it does not access any abstract variables.&nbsp; <br>Subclasses of&nbsp; B&nbsp; that want to access Q&nbsp; would need to state that they want a concrete
<br>versions of&nbsp; Q&nbsp; installed in their list of methods.&nbsp; One approach would be to write<br>the method&nbsp; Q in these subclasses as:<br><br>&nbsp;'Q<br>&nbsp; super&nbsp; Q'<br><br>In order to make it clear that a method is abstract I think the abstract variables
<br>of the method would need to be made more visible such as by making them bold<br>or red or both.<br><br>Clearly I haven't worked out all of the syntax needed for my proposal but<br>it seems not so difficult.<br>More difficult of course is the determining the ramifications of implementing
<br>this proposal.<br><br>I am interested in hearing comments on whether this proposal is good or bad<br>and why.<br>I would also like to have pointed out some of the more significant ramifications<br>of implementing this proposal.
<br><br>Thanks for listening.<br><br>Ralph<br><br><br><br><br>