Status: New
Owner: ----

New issue 3950 by [email protected]: SequenceableCollection>>#findBinary and friends (wrong exceptionBlock, delegation)
http://code.google.com/p/pharo/issues/detail?id=3950

Pharo 1.2 #12333

There is something wrong with how some of the exceptionBlocks of SequenceableCollection>>#findBinary and friends work. Some of them expect no arguments (as most #ifNone: exception blocks do), while others expect 2 arguments here (a low & a high bounds). Delegation among them is also strange as there seem to be two implementations. Some refactoring could be done. Unit tests are also missing. Some users are also vulnerable.

As an example, try these:

#(1 3 5 7 11 15 23) findBinary: [ :arg | 11 - arg ]
#(1 3 5 7 11 15 23) findBinary: [ :arg | 8 - arg ]

#(1 3 5 7 11 15 23) findBinary: [ :arg | 11 - arg ] ifNone: [ nil ]
#(1 3 5 7 11 15 23) findBinary: [ :arg | 8 - arg ] ifNone: [ nil ]

I could propose a fix, but I don't understand the reason behind the strange exception block: how could passing the low/high bounds be useful here ?

Sven




Reply via email to