From: nobu@... Date: 2016-01-11T02:33:58+00:00 Subject: [ruby-core:72803] [Ruby trunk - Bug #11975] Range#last is not consistent and possibly does not do what is expected. Issue #11975 has been updated by Nobuyoshi Nakada. Range is not only for discrete values. What will you expect for `(0.0...1.0).last`? ---------------------------------------- Bug #11975: Range#last is not consistent and possibly does not do what is expected. https://bugs.ruby-lang.org/issues/11975#change-56047 * Author: Samuel Williams * Status: Rejected * Priority: Normal * Assignee: * ruby -v: 2.3.0 * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- The following example demonstrates an inconsistency with Range: This is expected behaviour: ~~~ (0..10).last => 10 (0..10).to_a.last => 10 ~~~ This is unexpected behaviour: ~~~ (0...10).last => 10 # (should be 9?) (0...10).to_a.last => 9 ~~~ I believe that Range#last should give the last valid value for a range. Discussion? -- https://bugs.ruby-lang.org/ Unsubscribe: