lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I agree 100% with Alan here.

I really dislike using "nil" to mean anything other than "absent".

On Thu, Dec 04, 1997 at 05:02:32PM -0200, Alan Watson wrote:
> I keep banging up against the overloaded meaning of nil: something has
> no value and something is false.
> 
> This overloading causes me problems when I have tables in which a
> value can be absent, present and true, or present and false.
> 
> Furthermore, Lua is supposed to be useful as a configuration language.
> Which of the following do you prefer?
> 
> 	dothis = true
> 	dothat = false
> 	
> 	dothis = not nil
> 	dothat = nil
> 
> (A false solution to this second problem is to set "true = not nil".
> This idea has been explored extensively in C which has a somewhat
> similar problem. You end up with situtations where a variable can be
> true but not equal to the value of "true", for example, the value "2"
> is true, but is not equal to "not nil".)
> 
> Can someone persuade me that the current situation is a Good Thing
> and that a proper boolean type would not be a great improvement?
> 
> Alan Watson
> 

-- 
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@chat.net