Gavin Sinclair <gsinclair / soyabean.com.au> wrote: > On Saturday, July 19, 2003, 3:58:51 PM, Kurt 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 agree it would be cool, but it's pretty clear why Ruby doens't > support it: > > 2 < 3 == true > 1 < true == error > therefore 1 < 2 < 3 == error > > Ruby is a very expression-oriented language, and derives its strength > from conceptual purity. If an expression evaluated to X in some > circumstances and Y in others, a small part of Ruby would be lost. One way to do it would be to have 'if' call to_boolean on its argument, and have < return an object that carried some state around. martin