From: Michel Demazure Date: 2011-11-10T21:13:22+09:00 Subject: [ruby-core:40910] Re: [ruby-trunk - Feature #5607] Inconsistent reaction in Range of String It should be forbidden to have a Class (here Range) whose instance methods are linked by variable axiomatic relations, depending on the actual instance. There are too many different concepts covered by the same name Range. Actually, as the example shows, the situation is already strange for Strings (even before taking in account encodings, which add to the confusion). _md Benoit Daloze wrote in post #1031231: > P.S.2: I'm not sure it is right to use different methods (not only > #succ) in Range#each while being undocumented. It should probably > mention it uses String#upto for String and Symbol. > > P.S.3: Range uses #succ and #<=>, which might not be coherent as we see > in the case of String. How to solve that? > ---------------------------------------- > Feature #5607: Inconsistent reaction in Range of String > http://redmine.ruby-lang.org/issues/5607 > > Author: Yen-Nan Lin > Status: Open > Priority: Normal > Assignee: > Category: > Target version: > > > =begin > When I tried to access excel file, I found some inconsistent behavior > about range of string. > > ruby-1.9.3-p0 :001 > ("A".."AB").to_a > => ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", > "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "AA", > "AB"] > > This behavior is as what I thought. > > ruby-1.9.3-p0 :002 > ("X".."AB").to_a > => [] > > However, I tried to access "X" to "AB", and its reaction is inconsistent > with above example. > > I hope that behavior would be consistent in future release. > > Thanks! > =end -- Posted via http://www.ruby-forum.com/.