From: James Coglan Date: 2009-08-18T22:28:04+09:00 Subject: Re: Bizarre Range behavior --0015174764daa13a6c04716a7cd6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 2009/8/18 Yukihiro Matsumoto > Hi, > > In message "Re: Bizarre Range behavior" > on Tue, 18 Aug 2009 21:31:38 +0900, Daniel DeLorme > writes: > > |That sounds nice and consistent, but why limit ourselves to numbers? > | ("y".."aa").to_a > |should then generate ["y", "z", "aa"] since that's what String#succ > |generates. Sounds like this could snowball into a nightmare of > |incompatible changes. > > Indeed. The issue is that it's not easily distinguishable whether > a sequence using #succ from a string reaches to another, or not. > If there's affordable scheme to implement, I'd love to check in. For user-defined objects, the `<=>` method is used to determine whether the end of a range has been reached or exceeded, and it seems like 1.8 does this for strings (and numbers, of course). I prefer 1.8's consistent application of this rule. -- James Coglan http://jcoglan.com --0015174764daa13a6c04716a7cd6--