SortedCollection reversed...

goran.hultgren at bluefish.se goran.hultgren at bluefish.se
Mon Oct 22 13:10:54 UTC 2001


Mark van Gulik <ghoul6 at home.com> wrote:
> Creating a class BlockNegation that simply wraps an arbitrary block.  
> Give it the same basic protocol as a two-argument block.  Heck, let it 
> work for zero, one, or many arguments so you can easily use the same 
> class for inverting the sense of a "select"-like filter.  If you wish, 
> its instance creation can normally be triggered by sending a block the 
> #not message.  If you send a BlockNegation a #not message you get back 
> the block it wraps.  Make sure #numArgs (or whatever it's called in 
> Squeak lately) is also implemented in BlockNegation (delegate to the 
> wrapped block).

Yes, interesting approach! It's funny how easy it is to forget
polymorphism right? I mean, why an extra instvar when we can just
delegate the problem to the block...

I believe Ned Konz also presented something similar in a reply.

I have though submitted a very simple temporary "fix" proposed by Henrik
Gedenryd at OOPSLA to Doug Way implementing SortedCollection>>reversed
as "^self asOrderedCollection reversed" which at least removes the
strange state we could get into. It is not as controversial as the
BlockContext-stuff but it removes the bug for now.

But the approach of a "negated block", which I experimented with but
didn't really get to work (I gues I forgot about the fixTemps stuff),
looks kindof cool. I wonder what Dan thinks about this?

> BTW, your description of Dolphin's species change an the resulting 
> output didn't quite correspond (it looks like you claim #reversed 
> produced a SortedCollection instead of an OrderedCollection).

Oh, the example that followed my little note on Dolphin was not from
Dolphin - that was Squeak.

regards, Göran




More information about the Squeak-dev mailing list