On 11/16/05, Daniel Schierbeck <daniel.schierbeck / gmail.com> wrote:
> Currently, as far as I know, `if' and `unless' merely check if an object
> is of either types NilClass or FalseClass. This seems to contradict the
> duck-typing paradigm. I propose that we implement a method Object#to_b
> that is called by `if' and `unless'.It should return a boolean value.
> That way, a developer can decide whether or not an object should
> evaluate to true or false.

You could also ask that "and", "or", "not", "!", "||", "&&" be
operator methods.  I think the reason all of this is built-in is
performance.  All of this stuff doesn't have to go through the normal
method-call mechanism.  If you do a benchmark on "unless x" vs. "if
x.nil?" you'll see the difference.