Aha! How to get rid of Blocks in Smalltalk.
Karl Goiser
Lists at TassieMade.com.au
Fri Apr 21 06:08:33 UTC 2000
Hi David,
I have to agree with Bob Jarvis here: imagine a nested loop to
iterate over a multi-dimensional array, you would have to chase
through N methods in order to find out what is going on (where N is
the number of dimensions) etc etc.
To me, blocks in Smalltalk are about how to represent program flow in
an object oriented manner (sort of cheating really!).
For example,
in C:
for (i = 1; i <= 10; i++) { statement }
in Smalltalk:
1 to: 10 do: [ :i | statement ].
Sort of looks the same doesn't it? (But we all know that it works
quite differently.)
But you are right in that blocks are really classless methods.
Karl
More information about the Squeak-dev
mailing list
|