[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Undefined variables returning nil
- From: William Sumner <prestonsumner@...>
- Date: Tue, 19 Mar 2013 17:24:44 -0600
On Mar 19, 2013, at 4:43 PM, Geoff Leyland <geoff_leyland@fastmail.fm> wrote:
> On 20/03/2013, at 11:32 AM, 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. I'm suggesting that, unless there's a good reason for the current behavior that I'm unaware of, relying on user-implemented solutions is undesirable and that the language should raise an error because the current default behavior is unsafe.
>
> Please, no. "if table[key] then something() end" works. Otherwise we'd have to invent new syntax to check whether keys existed.
>
> Giving the user enough rope to implement solutions to their particular problems is a big part of what makes Lua what it is: relying on user-implemented solutions *is* desirable.
Why is it desirable to rely on user-implemented workarounds for unsafe behavior? Lua is targeted at non-professional programmers and is often exposed to them through scripting interfaces; this seems like an undue burden unless there is a technical reason for it.
Preston