[Date Prev][Date Next][Thread Prev][Thread Next][Author Index][Date Index][Thread Index]

A Macro for Steppers



Date: Mon, 11 Dec 89 01:39:25 PST
   From: xanadu!michael (Michael McClary)

   > From eric@son-of-blob Sun Dec 10 16:51:26 1989
   > 
   > A problem arises when the action in the Stepper loop involves a return
   > from the embodying function.  The execution scopes of X++ and Smalltalk
   > differ somewhat here:  A return in the X++ macro will return from the
   > function that uses the macro, whereas a return in the block in Smalltalk
   > would just return from the block, but not the calling method.  HughH is
   > suspicious that a solution exists for this problem, but we don't have it
   > yet. (Dean?)

   That makes the smalltalk "return" equivalent to the c(++) "break".

	   michael

In fact, the Smalltalk-80 return is the same as the C(++) return; it
returns from the context of the method in which the break was written,
not the block itself or the one in which it is executing. Smalltalk
has no simple equivalent of the "break" control flow. (It can be done
with exceptions, but it's grody.) The return value of a Smalltalk
block is that of the last statement executed in it. I'm not sure what
happens if you return a block as the value of a method and it has a
return in it; probably you get a run-time error. If it doesn't do a
return, you're ok, as smalltalk keeps a copy of the execution context.
	--ravi