From: Michael Neumann Date: 2005-02-23T03:54:16+09:00 Subject: Re: Proposal for nil, 0, and "" in an if statement Brian Mitchell wrote: > On Wed, 23 Feb 2005 03:00:03 +0900, Michael Neumann wrote: > >>Caio Tiago Oliveira wrote: >> >>>Michael Neumann, 22/2/2005 11:25: >>> >>>>100% agree. I especially cannot understand (at least mathematically) >>>>why 0 would be empty and 1 not. >>>>(...) >>> >>> >>>Binary logic, 0 is false, 1 is true. >> >>In fact, those are actual symbols and not numbers! > > > exactly! This issue seems to come up on the ML from time to time. I > voiced my opinion that Smalltalk conditionals (depending on behavior) > are much better than depending on value (check for nil or false). It > can be tailored to fit any object easily... but I think the idea lost > out to people who would rather keep ruby more of that same and > probably a little faster (though there are some things ruby can't do > because of this). My vote is still up for .true? {} and .false? {} > > ;-) > > I really don't care if you guys agree or not but it sure is elegant. > Ruby is already a very good language so I am happy anyhow. At least for .nil? I agree. I am not sure whether I'd like to write "if a.true?" all the time. Nevertheless I believe that if a.false? is clearer to read and understand than: if not a Just because human mind if very bad at negating conditions (proven by studies of some psychologists). Regards, Michael