From: hal9000@... Date: 2000-06-21T17:18:54+00:00 Subject: [ruby-talk:03585] Re: A small quiz I am somewhat mystified by why this should be considered a feature. (I did read PR#21 and Matz's reply.) I see there are two different things going on here: Either the indices are out of range (=> nil) or they are in reverse order (=> ""). But I am not sure what we gain by distinguishing between them. Under what circumstances would we WANT a null string to be returned? In any case, if this behavior is retained, the documentation at rubycentral should be changed, which says: "Returns nil if the initial offset falls outside the string, the length is negative, of the beginning of the range is greater than the end." According to this feature, the third condition does not hold. Hal Fulton In article , matz@netlab.co.jp (Yukihiro Matsumoto) wrote: > Hi, > > In message "[ruby-talk:03544] A small quiz" > on 00/06/20, Dave Thomas writes: > > |Andy and I were surprised by a Ruby feature. If you'd like, answer the > |following three questions without executing the code, then try it in > |Ruby and see if you were right. > > You mean `"hi"[2,1]', right? > > As I replied to Andy's bug report (PR#21), I consider it a feature. > But if it's surprising, I'm open to the discussion, according to the > principle of least surprise. > > matz. > > -- Hal Fulton Sent via Deja.com http://www.deja.com/ Before you buy.