[#23231] What do you think about changing the return value of Kernel#require and Kernel#load to the source encoding of the required file? — =?ISO-8859-15?Q?Wolfgang_N=E1dasi-Donner?= <ed.odanow@...>

Dear Ruby developers and users!

8 messages 2009/04/17

[#23318] [Feature #1408] 0.1.to_r not equal to (1/10) — Heesob Park <redmine@...>

Feature #1408: 0.1.to_r not equal to (1/10)

19 messages 2009/04/26

[ruby-core:23236] [Bug #1387] first(0) and last(0) behavior

From: Loqi Tamaroon <redmine@...>
Date: 2009-04-17 15:27:03 UTC
List: ruby-core #23236
Bug #1387: first(0) and last(0) behavior
http://redmine.ruby-lang.org/issues/show/1387

Author: Loqi Tamaroon
Status: Open, Priority: Normal
ruby -v: 1.8.6

I'm not sure if there was an explicit decision to have Array#first(0) and last(0) return the entire receiver, but it's messing me up slightly.

"abc".first(3) => "abc"
"abc".first(2) => "ab"
"abc".first(1) => "a"
"abc".first(0) => "abc"

There's similar behavior with last(0).

In my opinion, first(0) and last(0) should return a zero-length collection.

Is there a rationale for their current behavior, or is it a mistake?


----------------------------------------
http://redmine.ruby-lang.org

In This Thread

Prev Next