lua-users home
lua-l archive

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


Is the problem (supposing there is one) really the existence of nil or the fact that there are too many use cases for nil?

The main case I see against nil are that:
 1) it can mean different things
 2) it is not a real first-class value

Instead of removing nil, would it not be a better idea to add *more* kinds of "nil" values to differentiate between its uses? I think that's the approch taken by Haskell's Maybe monad (http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Maybe.html).

For those interrested, here is a post that compares "nil" values in different languages:

 original in French: http://www.bortzmeyer.org/exprimer-neant.html
Google translation: http://translate.google.fr/translate?js=n&prev=_t&hl=fr&ie=UTF-8&layout=2&eotf=1&sl=fr&tl=en&u=http%3A%2F%2Fwww.bortzmeyer.org%2Fexprimer-neant.html

--
catwell