Hi,
In message "[ruby-talk:01381] Re: Say hi (bis)"
on 00/02/15, pixel_ / mandrakesoft.com <pixel_ / mandrakesoft.com> writes:
|> It is for performance and unambiguity reason.
|
|i still find it a moot point:
|- either 0 || 4 should return true (C behaviour)
|- either 0 || 4 should return 4 (python and perl behaviour)
|- either 0 || 4 should raise "undefined method `||' for 0''
|(by the way can you redefine `||' ?) (ML family behaviour)
|
|tis the first time i see 0 || 4 returning 0, kinda weird.
I think it's the matter of how far we go to determine true/false.
i.e.
only #f is false, everything else is true(Scheme)
false and nil are false, everything else is true(Ruby)
false, nil and 0 are false, everything else is true
....
false,0,"",undef are false, everything else is true(Perl)
everything where len(n) == 0 is false, everything else is true(Python)
I feel Perl and Python went too far. Maybe we can add fixnum 0 to be
false, just for an idea.
matz.