<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2995" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=406451117-29112006><FONT face="Trebuchet MS" 
color=#0000ff size=2>Dear Ralph,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=406451117-29112006><FONT face="Trebuchet MS" 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=406451117-29112006>&nbsp;&nbsp;&nbsp; <FONT 
face="Trebuchet MS" color=#0000ff size=2>have you considered just to insert an 
abstract class for that prupouse?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=406451117-29112006><FONT face="Trebuchet MS" 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=406451117-29112006><FONT face="Trebuchet MS" 
color=#0000ff size=2>&nbsp;&nbsp;&nbsp; I can think in a trivial solution for 
you request in wich you make an abstract subclass of B that is parent of C and D 
in wich you can define it's common instVar b.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=406451117-29112006><FONT face="Trebuchet MS" 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=406451117-29112006>&nbsp;&nbsp;&nbsp; <FONT 
face="Trebuchet MS" color=#0000ff size=2>cheers,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=406451117-29112006><FONT face="Trebuchet MS" 
color=#0000ff size=2></FONT></SPAN><FONT face="Trebuchet MS" color=#0000ff 
size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face="Trebuchet MS" size=2><FONT 
face="Trebuchet MS" size=2>Sebastian Sastre</FONT></DIV>
<DIV align=left>
<DIV align=left><FONT face="Trebuchet MS" size=2></FONT>&nbsp;</DIV>
<DIV align=left><A title=mailto:ssastre@seaswork.com.ar 
href="mailto:ssastre@seaswork.com.ar"><FONT title=mailto:ssastre@seaswork.com.ar 
face="Trebuchet MS" size=2>ssastre@seaswork.com.ar</FONT></A><FONT 
face="Trebuchet MS" size=2> </FONT></DIV>
<DIV align=left><FONT face="Trebuchet MS" size=2>Seaswork&nbsp;</FONT></DIV>
<DIV align=left><I><FONT face="Trebuchet MS" size=2>Special Software 
Solutions</FONT></I></DIV>
<DIV align=left>&nbsp;</DIV>
<DIV align=left><FONT face=Verdana size=1>Este mensaje y sus adjuntos son 
confidenciales y de uso exclusivo para el usuario a quien esta dirigido. Puede 
contener información amparada por el secreto profesional. Si Ud. no es el 
destinatario especificado no debe copiar, enviar o utilizar ninguna parte del 
mismo y/o de sus adjuntos<SPAN class=643032423-05052005> por ningún medio 
tecnológico</SPAN>. Las opiniones vertidas son responsabilidad del autor y no 
son emitidas ni avaladas por&nbsp;<SPAN class=317392320-29042005>SEASWORK</SPAN> 
a menos que se indique claramente lo contrario y que la identidad y autoridad 
del autor, para comprometer a nuestra empresa, puedan ser verificados. No se 
garantiza la integridad de los mensajes enviados por e-mail ni que los mismos 
sean enviados en termino, o que no contengan errores o virus. El emisor no 
aceptara responsabilidad por los errores, modificaciones u omisiones que 
resulten en el mensaje, bajo la hipótesis de que pudo ser 
modificado.</FONT></DIV></FONT><A title=http://www.seaswork.com.ar/ 
href="http://www.seaswork.com.ar/"></A></DIV>
<DIV>&nbsp;</DIV><BR>
<BLOCKQUOTE 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=es dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> 
  squeak-dev-bounces@lists.squeakfoundation.org 
  [mailto:squeak-dev-bounces@lists.squeakfoundation.org] <B>On Behalf Of 
  </B>Ralph Boland<BR><B>Sent:</B> Wednesday, November 29, 2006 12:19 
  PM<BR><B>To:</B> squeak-dev@lists.squeakfoundation.org<BR><B>Subject:</B> 
  abstract variables proposalQQ<BR></FONT><BR></DIV>
  <DIV></DIV>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></BLOCKQUOTE></BODY></HTML>