Issue 3950 in pharo: SequenceableCollection>>#findBinary and friends (wrong exceptionBlock, delegation)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 3950 in pharo: SequenceableCollection>>#findBinary and friends (wrong exceptionBlock, delegation)

pharo
Status: New
Owner: ----

New issue 3950 by [hidden email]:  
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 | Threaded
Open this post in threaded view
|

Re: Issue 3950 in pharo: SequenceableCollection>>#findBinary and friends (wrong exceptionBlock, delegation)

pharo

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

See Issue 3345

Something went wrong when the same was attempted in Pharo...
(Not using cull, not rewriting the methods which were part of old api, etc.)

Personally, I'm not sure what the actual benefits of a do: parameter, and  
hi/lo error parameters are.
Juan and Levente are usually pretty smart guys though :)



Reply | Threaded
Open this post in threaded view
|

Re: Issue 3950 in pharo: SequenceableCollection>>#findBinary and friends (wrong exceptionBlock, delegation)

pharo

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

You're right, that issue deals with the same subject, and from a first  
look, modulo some units tests, should solve the issue that I raised.

I did not know that a multi argument #cull:[cull:[cull:]] silently skipped  
arguments until the block's argument count matches.

I should have searched the issue list first, thanks for the pointer.

Sven



Reply | Threaded
Open this post in threaded view
|

Re: Issue 3950 in pharo: SequenceableCollection>>#findBinary and friends (wrong exceptionBlock, delegation)

pharo

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

Issue 3345 has been merged into this issue.