From: Daniel Luz Date: 2009-01-02T20:28:21+09:00 Subject: [ruby-core:21064] Re: Definable != is a Bad Thing??? On Fri, Jan 2, 2009 at 01:37, Ken Bloom wrote: > 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 What I personally don't like about this is that it gives you a false sense of control. We still can't handle && and ||, not to mention "untracked" objects (`f(1 + 1)` will probably be caught as `f(2)` in most fake parsers) or more complex relationships between two or more objects. So, I liked the idea of leaving all the basic boolean logic outside of the language, since we don't have access to other key parts of it anyway. -- Daniel