Aha! How to get rid of Blocks in Smalltalk.

Bert Freudenberg bert at isgnw.CS.Uni-Magdeburg.De
Thu Apr 20 22:40:52 UTC 2000


On Thu, 20 Apr 2000, Travis Griggs wrote:

> Bert Freudenberg wrote:
> 
> > <snip>
> >
> > This would also allow reuse - blocks aren't reusable at all, you have
> > to write them again and again! And for stuff that does not need to be
> > reused we could invent some syntax to actually define such a class
> > in-place. This should parallel the totally cool "inner classes" concept of
> > Java (see, for example,
> > http://www.javaworld.com/javaworld/jw-10-1997/jw-10-indepth_p.html)
> >
> > Instead of writing
> >
> >         aCollection do: [:each | each doSomething]
> >
> > you could write (using Java)
> >
> >         aCollection.do( new
> >            class MyInnerClass implements BlockLike {
> >              int value(int each) {
> >                return each.doSometching();
> >              }
> >            }
> >         )
> >
> > Wouldn't that just be great?
> >
> >   -Bert-
> >
> > PS: ;-) ;-) ;-)
> 
> You're being sarcastic right? Just checking; I much prefer the former.

It was meant ironic. If this was a Java list, and I was forced to
actually use this, it would have been deeply sarcastic. 

  -Bert-





More information about the Squeak-dev mailing list