From: Ken Bloom Date: 2009-01-02T12:37:38+09:00 Subject: [ruby-core:21058] Re: Definable != is a Bad Thing??? Ryan Davis wrote: > > On Dec 29, 2008, at 17:13 , Yukihiro Matsumoto wrote: > >> |== and != should not be able to contradict each other. >> | >> |Is this a bug? I looked at the code and it looks intentional. Should >> |it be allowed? >> >> It's intentional. Ruby's flexibility sometimes allows you to do some >> nasty things. Ruby consider you smart enough to avoid such >> contradiction. > > ok... but why? It's for doing things with builders, where you care about knowing whether == or != was called, but you don't care so much about the result (or the result is a dummy object that responds to more messages and logs more stuff). For example in Ruby Quiz 95, where the goal was to capture an s-expression representing an expression, no pure-Ruby solution could capture ! or != in Ruby 1.8. Now, in Ruby 1.9, they can capture ! and != without needing to resort to RubyNode or ParseTree. --Ken -- Chanoch (Ken) Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/