EndOfStream unused

Paolo Bonzini bonzini at gnu.org
Thu Nov 8 17:22:04 UTC 2007


> Stream>>next
>   ^ self nextIfAtEnd: [ ^ nil ]
>
> Stream>>nextIfAtEnd: anEndBlock

If you don't care about the cost of creating a block (and on "real" 
closure implementations blocks that return are the most expensive ones), 
you will just use #do:.  This will kill performance 100 times more than 
an EndOfStream notification.

Smalltalk people sometimes seem to be allergic to thinking out of the 
box.  #at:ifAbsent:-like things have a place, exception handling has a 
similar but different place.  Nobody is proposing to have millions of 
exceptions as in Java.

Paolo



More information about the Squeak-dev mailing list