On Sat, Jun 16, 2001 at 10:56:28PM +0900, Yukihiro Matsumoto wrote: > In message "[ruby-talk:16529] Re: why only nil and false are regarded as false?" > on 01/06/16, Dave Thomas <Dave / PragmaticProgrammer.com> writes: > > |> I would appreciate some explanation on why Ruby behaves like > |> this > | > |I suspect because the alternatives in other languages were error > |prone. I know I've been bitten by loops that terminated prematurely in > |Perl. > > Yes. Plus I wanted performance in boolean tests. Current boolean > test can be done in single bit operation in C, no method invocation, > no complex switching based on type. Ah, performance is the key. I always wonderd, why you did not take an elegant route similar to the test for nil: Every object can be asked nil?(), but usually only nil of NilClass answers true to this. It would be nice if there were a true?() just like there is a nil?(), but since boolean tests are much more common than tests for nil this performance tweak seems justifiable. Still I always remain skeptical about performance bargains, trembling when I think about int vs. Integer in java. -- marko schulz Dieser Satz beinhalten drei Fehller.