Aha! How to get rid of Blocks in Smalltalk.

Jesse Welton jwelton at pacific.mps.ohio-state.edu
Fri Apr 21 13:53:07 UTC 2000


David Farber wrote:
> 
> Peter
> 
> At 09:40 AM 4/20/00 +0100, you wrote:
> >The other use is passing in a block that binds to some variables in a method
> >but outside the block; I'm not sure how your scheme would handle this.
> 
> it would. imagine blocks as they are now, except that you are allowed only
> one message send in the block. any variable you wanted to bind would be
> passed to that one method.
> 
> |foo|
> aCollection do: [:each | self doSomethingWith: foo with: each]

It seems like this would be monstrously annoying if the required input
parameters vary over time.  If you make a change so that you also now
require the use of a local variable bar, you must compile a new method
which also takes bar.  Now suppose foo becomes unnecessary, or should
be replaced with foo squared; that's another method to compile.  Then
you also have to go back and do cleanup, deleting the unused methods.
But if you go back to an older design...  It all just seems markedly
more troublesome than changing a block.

Another thing you would lose is the ability to code arbitrarily
complex one-offs in a workspace.

-Jesse





More information about the Squeak-dev mailing list