lua-users home
lua-l archive

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


On Tue, Mar 19, 2013 at 05:24:44PM -0600, William Sumner wrote:
> 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.
> 

You keep asserting that this is unsafe behavior. Please elaborate.

I once knew an adjunct professor who wrote a paper arguing for the necessity
of a new type distinct from void, null, empty, etc. I forgot how many such
types already existed in the literature; his was the fourth or fifth, I
believe.

His day job was as a statistician for the US government, where he crunched
and analyzed huge amounts of information. Apparently he felt that the
existing input types were too ambigious.

He argument was intriguing. (I wish I could actually rememeber it! I was too
ignorant at the time to grasp the nuance.) But even if his contention was
correct in a strict sense, it didn't necessarily invalidate or taint the
contemporary method of data analysis. Generally speaking, it merely made it
less precise, although there were other counterveiling benefits--arguably
more reliable and consistent data, as few people devising and executing the
data collection schemes would comprehend the distinctions.

Likewise, while nil is tasked with double, triple, or quadruple duties, that
doesn't necessarily make Lua or its type semantics unsafe. If you believe
so, you must elaborate.