<br><br><div class="gmail_quote">On Tue, Nov 25, 2008 at 11:40 PM, Igor Stasenko <span dir="ltr"><<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
2008/11/25 Michael van der Gulik <<a href="mailto:mikevdg@gmail.com">mikevdg@gmail.com</a>>:<br>
<div class="Ih2E3d">> Hi all.<br>
><br>
> What would people's reaction be if a class was prevented from being able to<br>
> directly access its superclass's instance variables? A subclass should use<br>
> accessor methods to access a superclass's instance variables.<br>
><br>
> Is there any particular reason subclasses get access to superclass instance<br>
> variables? I think it breaks encapsulation.<br>
><br>
> If this was implemented, it might be possible to avoid needing to recompile<br>
> every subclass when you modify the instance variables of a class.<br>
><br>
</div>No, you can't avoid recompiling.<br>
Suppose base class having vars:<br>
0 - a<br>
1 - b<br>
<br>
and subclass<br>
<br>
2 - d<br>
3 - c<br>
<br>
now, if you add or remove vars in base class, indexes of 'd' and 'c'<br>
variables will be shifted correspondingly. And therefore it would<br>
require to recompile all methods where you using 'd' and 'c' ivars. It<br>
also may require recompiling methods in base class, when you inserting<br>
a var before a or b.. or removing var 'a'. - for same reason - indexes<br>
will be shifted.<br>
</blockquote></div><br>I was thinking, briefly, about modifying the VM and object memory format so that instance variables are always indexed beginning from 0 for every subclass. Somehow.<br><br>It isn't necessarily a good idea. I haven't thought through the details yet.<br>
<br>Gulik.<br clear="all"><br>-- <br><a href="http://people.squeakfoundation.org/person/mikevdg">http://people.squeakfoundation.org/person/mikevdg</a><br><a href="http://gulik.pbwiki.com/">http://gulik.pbwiki.com/</a><br>