On Mon, Jul 14, 2003 at 08:23:48PM -0700, robert ehteshamzadeh wrote:
> >>  I am constantly being bitten by the fact that 0 is true.
> 
> How about this :  all non-nil objects are true, with the exception of
> instances of FalseClass.

Ok, see, I have absolutely no problem understanding the concept.
Easy as pie.  I know that 0 is true, and I know why it is true.
But a couple decades of programming habits step in and write things
(like "if n" where I intended "if n==0") on my behalf long before
my brain can step in and think "But what is Truth?  Is Truth 
unchanging law?"

Most of my non-Ruby programming these days is in Java, and I do the
same thing there, but at least the compiler catches it and yells at me.
:)

> The same issues come up in SQL,  where not only is a numeric 0 non-nil,
> but so is zero-length string.

Yeah, but that's not the same issue.  Since SQL is a declarative
language, I have never once mistaken it for C :-), and I do not
generally think of null database fields as equivalent to Boolean
"false".  Instead they are an entirely different beast which requires
things like NVL() (or COALESCE() or whatever your favorite RDBMS calls it);
I put nulls in the same general category as outer joins and such:
Ways To Deal With Data What Just Ain't There.

Thanks, though.

-Mark