[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Different shades of false
- From: "Adam D. Moss" <adam@...>
- Date: Thu, 02 Mar 2006 20:30:26 +0000
Tobias Käs wrote:
At the other point you argue "" == 0 incase 'if' treats them the same.
I'm not sure that's what Ryanne is saying, but it doesn't
really matter. :)
So if you say "undefined" evaluates to "false" in the context of an 'if'
(even though they are not the same), you could as well say "empty"
should evaluate to "false" in the same context.
I think the point there is that the argument seems to be going
around that 'if there are already two ways to say false, then
why not four or more?'. But (other good counterarguments aside!)
there aren't two ways to say false; there's one way to say false
and one way to say undefined, where for IMO *overwhelming* practical
and Lua-historical reasons the latter is also considered not-true
in a boolean expression.
Some people would like to see other specific values of other
particular types evaluate to not-true in a boolean expression,
for convenience in their particular application domain or to
match their favourite other-language. There might be some good
practical arguments in that direction, of which 'it might not
be better, but it certainly is not worse' isn't really one. :D
Pragmatically I'm not really interested in other values
coercing to false but if it's cheap to implement then the idea
doesn't completely horrify me. A few weeks ago someone asked
for a __toboolean sort of metamethod; combined with Lua 5.1's
per-type metatables this could give people whatever boolean
coercions they consider tasteful. Again not too impressed
by the idea but it's a direction to consider.