Project

General

Profile

Actions

Bug #7726

closed

bsearch should handle block result in a consistent way

Added by marcandre (Marc-Andre Lafortune) over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
r38825
Backport:
[ruby-core:51565]

Description

The documentation states that the block of bsearch must
return either true/false or a number.

If the block returns another object (other than nil), I feel that either

  1. It should be considered as 'truthy'
  2. It should raise a TypeError

Currently it does not raise an error and returns a result different than if true was passed:

(1..3).bsearch{ 'x' } == (1..3).bsearch{ true } # => false

Updated by marcandre (Marc-Andre Lafortune) over 9 years ago

  • Status changed from Open to Closed
  • Assignee set to marcandre (Marc-Andre Lafortune)

Fixed with r38986.

Actions

Also available in: Atom PDF