From: gabriele renzi Date: 2004-05-19T18:03:47+09:00 Subject: Re: Zero is true ... whoda thunk? il Tue, 18 May 2004 20:32:41 -0700, "Michael Geary" ha scritto:: >Because in the real world, zero means false. Following your logic there should be a to_bool() method for every class , say: an empty string, and empty array, an empty set, are clearly false. When is a regex false? Maybe never ? What about an Hash ? what is the behaviour you do espect ? Note that I know that some languages have an equivalent of to_bool()[1], but it just makes, imo, the thing harder to grasp: when I use a new class can I expect that if myobj would fail cause ZeroableObj(0 , '') will appear as false while MyOthjerObj(0, '') does not ? >Suppose you have zero quarts of milk in your refrigerator. I am visiting and >I ask: > >Got milk? > >What's your answer, yes or no? > >No, of course. I agree, and I think that having a to_bool makes sense. Still, I prefer the way it is now.