[#23657] [Bug #1550] String#lstrip! raises RuntimeError on Frozen String Despite Making No Changes — Run Paint Run Run <redmine@...>

Bug #1550: String#lstrip! raises RuntimeError on Frozen String Despite Making No Changes

13 messages 2009/06/01

[#23729] [Bug #1583] Time + String no Longer Raises TypeError? — Run Paint Run Run <redmine@...>

Bug #1583: Time + String no Longer Raises TypeError?

14 messages 2009/06/05

[#23770] [Bug #1595] rake unusable on windows install — Robert Gonzalez <redmine@...>

Bug #1595: rake unusable on windows install

10 messages 2009/06/09

[#23869] [Bug #1640] [PATCH] Documentation for the Rational Class — Run Paint Run Run <redmine@...>

Bug #1640: [PATCH] Documentation for the Rational Class

12 messages 2009/06/16

[#23903] [Bug #1648] Rational#div Raises NoMethodError for Invalid Argument — Run Paint Run Run <redmine@...>

Bug #1648: Rational#div Raises NoMethodError for Invalid Argument

9 messages 2009/06/17

[#23977] [ANN] meeting log of RubyDeveloperKaigi20090622 — "Yugui (Yuki Sonoda)" <yugui@...>

Hi,

41 messages 2009/06/23
[#23979] Re: [ANN] meeting log of RubyDeveloperKaigi20090622 — Run Paint Run Run <runrun@...> 2009/06/23

Thanks for the update. :-)

[#24173] Re: [ANN] meeting log of RubyDeveloperKaigi20090622 — "NARUSE, Yui" <naruse@...> 2009/07/07

Sorry for late response,

[#24174] Re: [ANN] meeting log of RubyDeveloperKaigi20090622 — Luis Lavena <luislavena@...> 2009/07/07

On Tue, Jul 7, 2009 at 12:12 AM, NARUSE, Yui<[email protected]> wrote:

[#24242] Re: [ANN] meeting log of RubyDeveloperKaigi20090622 — Charles Oliver Nutter <headius@...> 2009/07/09

On Mon, Jul 6, 2009 at 10:18 PM, Luis Lavena<[email protected]> wrote:

[#24010] [Bug #1685] Some windows unicode path issues remain — B Kelly <redmine@...>

Bug #1685: Some windows unicode path issues remain

26 messages 2009/06/24
[#29189] [Bug #1685] Some windows unicode path issues remain — Yuki Sonoda <redmine@...> 2010/04/01

Issue #1685 has been updated by Yuki Sonoda.

[#29200] Re: [Bug #1685] Some windows unicode path issues remain — Bill Kelly <billk@...> 2010/04/01

Yuki Sonoda wrote:

[#29892] Re: [Bug #1685] Some windows unicode path issues remain — Bill Kelly <billk@...> 2010/04/29

Hi,

[#24058] [Bug #1696] http downloads are unuseably slow — Steven Hartland <redmine@...>

Bug #1696: http downloads are unuseably slow

19 messages 2009/06/27

[#24063] [Feature #1697] Object#<=> — Marc-Andre Lafortune <redmine@...>

Feature #1697: Object#<=>

15 messages 2009/06/28

[ruby-core:23706] Inconsistent behavior on 1.8 and 1.9 of String#[]= with single Fixnum argument

From: brian ford <brixen@...>
Date: 2009-06-04 18:23:50 UTC
List: ruby-core #23706
Hi,

String[]= behaves differently on 1.8 and 1.9 when given a single
Fixnum argument == to the size of the string. Given the following
code:

$ cat string.rb
s = ""
p s[0]

s[0,0] = "a"
p s

s = ""
s[0] = "a"
p s

s = "x"
s[1] = "a"
p s

these are the results:

$ ruby -vw string.rb
ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]
nil
"a"
string.rb:8:in `[]=': index 0 out of string (IndexError)
        from string.rb:8

$ ruby1.8 -vw string.rb
ruby 1.8.8dev (2009-06-04 revision 23638) [i386-darwin9.7.0]
nil
"a"
string.rb:8:in `[]=': index 0 out of string (IndexError)
        from string.rb:8

$ ruby1.9 -vw string.rb
ruby 1.9.2dev (2009-05-28 trunk 23601) [i386-darwin9.7.0]
nil
"a"
"a"
"xa"


Given any string s of N characters, s[N] == nil, so I understand that
to mean that N is out of the bounds of the string. The RDoc for
String#[]= states that

  "The forms that take a +Fixnum+ will raise an +IndexError+ if the value
    is out of range; the +Range+ form will raise a +RangeError+, and the
    +Regexp+ and +String+ forms will silently ignore the assignment."

The RDoc does not appear to have changed on 1.9.

So, my questions are:

1. should ""[0] = "a" work on 1.8 the way it does on 1.9?
  OR
2. should ""[0] = "a" raise an IndexError on 1.9?

If the answer to the above is "it should raise an IndexError on 1.9",
then should ""[0,N] = "a" also raise an IndexError?

If the answer is ""[0] = "a" should work as it does on 1.9, can we
please update the RDoc to somehow explain that while s[N] is out of
bounds of the string, you can "replace" that non-existent character
with an arbitrary length string.

Cheers,
Brian

In This Thread

Prev Next