Need feedback on simple idea

Stephane Ducasse ducasse at iam.unibe.ch
Thu Apr 10 20:36:42 UTC 2003


Hi

I would like to know what you would think of the following change in 
Smalltalk.
We are really in the mood to make some change in the compiler to play 
with the idea
for our research.

remove direct access to instance variables a la self

a class still defines instance variable but we cannot access directly 
instance variables accessors are automatically optimized to use direct 
access by the compiler.

Pros:
	simplicity/uniformity no distinction between state and methods.

Cons:
	no private iv anymore anymore (except if we try to have a clever schema
	that lets the programmer writing self x while the byte code remove the 
send)
	with this schema we could have private instance variables but be 
forced to used a 	normal method to make public an accessor.
	
	m
		self x
	<=>
	m
		x

	public accessor could be then

	getX
		self x

Applicability to Squeak:
	- would break all the accessors that do something more that accessing
	(self changed) but we could use a dedicated parser/compiler so that the
	changes only impact a subset.






Prof. Dr. Stéphane DUCASSE
http://www.iam.unibe.ch/~ducasse/
  "if you knew today was your last day on earth, what would you do 
different? ...  especially if,
  by doing something different, today might not be your last day on 
earth" Calvin&Hobbes

"The best way to predict the future is to invent it..." Alan Kay.

Open Source Smalltalks: http://www.squeak.org, 
http://www.gnu.org/software/smalltalk/smalltalk.html
Free books for Universities at 
http://www.esug.org/sponsoring/promotionProgram.html
Free Online Book at 
http://www.iam.unibe.ch/~ducasse/WebPages/FreeBooks.html


More information about the Squeak-dev mailing list