[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Idea. Removing nils from the language.
- From: Tim Hill <drtimhill@...>
- Date: Fri, 9 Jan 2015 21:14:55 -0800
> On Jan 9, 2015, at 12:45 PM, Enrique Arizón Benito <firstname.lastname@example.org> wrote:
> as Rob Kendrick indicated, replacing nil and raising an exception is the only possibility. (and it's a good thing to do, since this avoid the program to continue with an un-initialized variable).
But there is no such thing as an uninitialized variable in Lua. In Lua, all variables always contain a value at all times, and sometimes that value happens to be nil, be it a local variable, global, upvalue or function argument. In fact, one way to conceptualize a Lua table is that every table has ALL possible keys defined (an infinite number of keys), the vast majority of which just happen to contain nil.