Path: utzoo!attcan!utgpu!watmath!iuvax!rutgers!usc!celia!peter
From: peter@celia.UUCP (Peter Farson)
Newsgroups: comp.lang.smalltalk
Subject: A strange Context method in Smalltalk/V
Message-ID: <538@celia.UUCP>
Date: 15 Aug 89 10:35:00 GMT
Reply-To: celia!peter@tis.llnl.gov (Peter Farson)
Organization: Rhythm & Hues, Inc., Hollywood
Lines: 31
References:

The other day, while browsing through the classes (Smalltalk/V Mac), I
noticed a strange method in class Context.  The source looked like this:


value
	"Answer the result of evaluating the no argument block
	described by the receiver."
	self checkArgument: 0.
	^ self value


Now this seems very odd to me.  It looked like an endless recursive loop
to me, so I stuck a "self error: 'say something'" in it, and then tried
sending this message to a block.  No debug windows popped up.  Only when
I tried "[block] perform: #value" did it seem to actually execute the
modified method.  The only thing I can figure out is that the Smalltalk
compiler treats some source code expressions as special cases, producing
byte-codes that are optimized but that end up not invoking the method that
it by definition should.  The methods for "value:" and "value:value:" are
similar.

Does anyone know what's really going on here?  If the compiler has exceptions
to the rule, how many and what are they?  If anyone knows something about
this, I would very much like to hear from them.


-- 
Can a bee be said to be                Peter Farson
An entire bee if                       celia!peter@tis.llnl.gov
Half the bee is not a bee              ...{ihnp4,ames}!lll-tis!celia!peter
Due to some ancient injury?