Hi

As an exercise, I've implemented a simple Generator using only blocks:

��� gen :=
��� ��� [
��� ��� ��� [ | currentValue |
��� ��� ��� Array
��� ��� ��� ��� with: [ currentValue := 0 ]
��� ��� ��� ��� with: [ currentValue := currentValue + 1 ]
��� ��� ��� ] value
��� ��� ] value.

��� gen first value.
��� next := [:a | a last value].

��� getTen := [(1 to: 10) collect: [ :i | next value: gen ]].

��� getTen value = #(1 2 3 4 5 6 7 8 9 10).
��� getTen value = #(11 12 13 14 15 16 17 18 19 20).�


There have been some funny arguments in the past whether Blocks are a fundamental part of Smalltalk or not. My code above supports Vassili's view that we could get rid of Objects and implement everything in terms of Blocks.


But more seriously, I find it quite interesting that Lars Bak choose not to implement Blocks for his Resilient Smalltalk. He choose to implement LIFO blocks; that is, blocks that cannot survive the creating activation context (see chapter 2.3 for more details).