[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:16:47 -0600
On Mar 19, 2013, at 4:43 PM, Petite Abeille <petite.abeille@gmail.com> wrote:
> 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.
> Perhaps if you spell out what specific problem/scenario you are trying to sort out, then someone could suggest something constructive. Generalities are not going to get you very far.
I don't know how to be more specific. The behavior of silently returning nil for accesses of undefined variables is unsafe, so I was wondering if changing this behavior has been considered for a major version update of the language, and if there are reasons for retaining the current behavior. I'm aware of user-implemented solutions, but it would seem to me preferable to make the safe behavior the default since there isn't a valid reason I can think of that one would want an uncaught bug to be standard behavior.
>> 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
>
> I'm a user, and I'm just fine as it is. But thanks for your concern.
>
>> and that the language should raise an error because the current default behavior is unsafe.
>
> 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.
Preston