Compiler And Evaluate Block Bug?

R. A. Harmon harmonra at webname.com
Tue Dec 7 23:42:56 UTC 1999


At 07:52 PM 12/7/99 +0100, Bert Freudenberg wrote:
>On Tue, 7 Dec 1999, R. A. Harmon wrote:
[snip]
>> (Compiler evaluate: '[ :xxx | ^xxx].'
>> ) value: 2
>> 
>> signals a block cannot return error exception
[snip]
>If you omit the ^ it works just fine.
>
>I'm not sure if this is to be considered a bug. Compiler>>evaluate: 
>compiles that code into a temporary method, executes this method, and
>returns the result. At the time you send #value to the resulting block the
>method context doesn't exist anymore, so you can't return from it either.

Thanks.  I start getting a little light-headed when I think about block
context and the world get sort of all wavy.

I want to be able to give an object the source code of a block (example: a
SortedCollection sort block but in source code, not the block object).  The
object compiles and saves it.   At a latter time, the saved block can then
be evaluated to sort the collection.

The object I want to do this with needs more complicated code than that of
the default sort block ([:x :y | x <= y]).  I'd like to be able to use a
return (as an early exit), but I can get along without it.  Is there a
relatively simple way to do it and keep the context?

--
Richard A. Harmon          "The only good zombie is a dead zombie"
harmonra at webname.com           E. G. McCarthy
Spencer, Iowa





More information about the Squeak-dev mailing list