[net.lang.st80] more on blocks

budd@arizona.UUCP (tim budd) (01/26/84)

Ok.  here is another question on blocks.  (I'm attempting to teach myself
the language from the blue book, and since I don't have access to a smalltalk
system I can't answer these questions experimentally.  Perhaps some of you
how do have access to such systems can help me out).

Suppose I have the following class:

Class Awfully

        silly
                ^ [ ^ 0 ]

Now, suppose I do
        i <- Awfully silly .
        j <- i value .

What should happen?  what DOES happen in the z-rocks smalltalk system?
Note that the problem is that the block does an RETURN, rather than just
yields a value.  If I had written [ 0 ] the answer would clearly be that
j gets the value zero.  But in this case the instance of the class Awfully
(Awfully itself in this example) has already been popped from the stack,
so there is nowhere for the block to return FROM - or am I missing something?