In article <20030719060149.GA2247 / math.umd.edu>, Daniel Carrera <dcarrera / math.umd.edu> wrote: >-----BEGIN PGP SIGNED MESSAGE----- >Hash: SHA1 > >I don't know if there's a good reason for it, but I think it'd be cool if >Ruby had it. > >On Sat, Jul 19, 2003 at 02:58:51PM +0900, Kurt M. Dresner wrote: >> When I learned python I was overjoyed that I could evaluate 1 < 2 < 3 >> and get "true". I just realized that you can't do that in Ruby. Is >> there a reason why? Is it good? I know I can use "between", but >> still... >> I can see how it would be cool, however: 1 < 2 #this gives a value of true 1 < 2 < 3 #this calls the '<(3)' method on true It essentially looks like: (true) < 3 Which is meaningless. to do this you've got to somehow change the parser so that for the special cases of <,>,<=,>= you instead call the method on the middle value in the chain of thee values. Or you've got to somehow make '1 < 2' return 2 instead of/or in addition to true. Seems problematic and could very likely break things. 2.between?(1,3) May not look as pretty, but works fine without potential parser headaches. Phil