Robert Klemme schrieb:
....
> class Object
>  def to_b() self end
> end
> 
> class SpecialBoolHandling
>  def to_b ... end
> end
> 
> if x.to_b
>  ...
> else
> ..
> end
> 
> I believe I've read a comment of Matz about this (implicitely calling 
> to_b or somethig similar) where he mentioned performance as the reason 
> why not to do it, bI'm not 100% sure.

I once proposed a "truth" flag scheme akin to Ruby's
"tainted" and "frozen" flags schemes which can implemented
with an (depending on taste) acceptable performance penalty.
I believe that the implementation ([ruby-core:279] and
[ruby-core:294]) is still valid.

I'd also choose this truth flags scheme over boolean
conversion methods any day, irrespective of performance
issues.


/Christoph