lua-users home
lua-l archive

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


>> On Mar 19, 2013, at 11:32 PM, William Sumner <prestonsumner@me.com> wrote:
>> 
>>> I know Lua only has tables. Because they're used for arrays, classes, and more, catching only undefined globals is insufficient.
>> 
>> Non sequitur. What else is there?
>
>I'm not sure what you're calling a non sequitur, but in case you misunderstood me, silently getting nil back when accessing a non-existent table element is unsafe, particularly because tables are used for so much, so simply catching undefined global accesses and not undefined elements is insufficient.

Insufficient to /you/ but absurd to other Lua users, hence a non-sequitur. Most of us don't want tab[rnd()] to return anything but nil.

It seems you're coming from a higher-level language to claim what is sufficient and what isn't -- maybe ActionScript which IIRC differentiates between uninitialized, nil and value -- but all of this is subjective and ultimately a trade-off.

Lua aims for simplicity and speed: nil means "is not there" unless you want to tack on a higher-level meaning, as suggested earlier.

That's already a step up (abstraction-wise) from C/C++; if you don't appreciate Lua's simplicity and want more hand-holding then stick to a higher-level language. Or better yet, embed Lua where you think it benefits you and use other languages where you think it doesn't.

>> Hmm, thanks, but no thanks. Feel free to change your own copy of Lua in any way, shape, or form, you see fit.
>
>Well, I don't understand your defensiveness; I'm just making a suggestion.

Don't read ulterior motives in this remark: you REALLY are welcome to change the language as you see fit.

cheers,

-- p