Steven / ruby-lang.org wrote:
> Jamis Buck <jgb3 / email.byu.edu> writes:
> 
>>I'm SO glad that Ruby forces you to compare numbers explicitly, instead 
>>of implicitly converting to bool. It makes code that much more readable.
> 
> 
> It doesn't, though.  This code will always print "foo":
>     a = SomethingReturningANumber()
>     if (a)	# Probably meant to say "a != 0", or maybe "a == 0"
> 	puts "foo"
>     end
> I think it _should_ force you to compare numbers explicitly -- comparisons
> should raise exceptions if passed anything other than booleans.  But it's
> too late for such a change.
> --
> 	Steven
> "No egg nog!  In fact, no nog, period!"

Sorry -- I mispoke. My "force" I meant that Ruby requires you to do 
explicit numeric comparisons for your conditions to work correctly, not 
that it actually enforces that programming practice. You're right, 
though. It would be nice if Ruby enforced that.

-- 
Jamis Buck
jgb3 / email.byu.edu
http://www.jamisbuck.org/jamis

ruby -h | ruby -e 
'a=[];readlines.join.scan(/-(.)\[e|Kk(\S*)|le.l(..)e|#!(\S*)/) {|r| a << 
r.compact.first };puts "\n>#{a.join(%q/ /)}<\n\n"'