From: Daniel Luz Date: 2009-01-02T22:29:09+09:00 Subject: [ruby-core:21067] Re: Definable != is a Bad Thing??? On Fri, Jan 2, 2009 at 09:42, Kornelius Kalnbach wrote: > Daniel Luz wrote: > the problem is short-circuit evaluation, I guess. Yes, and that's pretty hard to solve in a strict evaluation language without killing performance. > we do: &, ^ and |, ~, and now ! can be redefined as you want. you > wouldn't expect to be able to redefine "not", "and", and such things. Of these operators, only ! is strictly related to the language's boolean logic. All others may serve that purpose when invoked on booleans, but still serve bigger purposes like bitwise and set operations. (And by the way, since `not` is just the same operation as ! on a different precedence, redefining ! already affects it on 1.9.) I like Ruby's simplicity in keeping only false and nil as non-true values, and overloading boolean operators somewhat kills that. If we keep this road, not only we'll live forever with the bigger holes (short-circuit evaluation, complex operations on pseudo-AST objects like variable assignment, etc), but eventually people will also request a `?` method to redefine an object's truth value, so that their proxy to nil still evaluates as false. -- Daniel