lua-users home
lua-l archive

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


On Mar 19, 2013, at 10:51 PM, Coda Highland <chighland@gmail.com> wrote:
> 
> No one disagrees it's a legitimate issue, but do you blame C for a
> lack of error reporting for uninitialized memory accesses, or do you
> use Valgrind to find them? Not every solution has to be implemented in
> the language core. It's completely acceptable for an external tool to
> provide techniques to resolve the problem.

Going by the responses, I think many actually do disagree that it's a legitimate issue, but to answer your question: lots of people blame C for its error-prone access to raw memory; in fact, it's one of the motivations for using Lua! More to the point, C doesn't detect uninitialized memory accesses because it's a systems language with different requirements than that of an embedded scripting language targeting non-professional programmers. C's lack of error-reporting in that case has nothing to do with Lua's lack of error-reporting in this one.

One's response might be to take that statement and say, "Well, Lua has different requirements from what you're wanting", which is in the vein of what has been said by others, but there's really been no explanation of what the key requirement is that makes it a necessity to silently evaluate to nil instead of report the error. If the only explanation is that it's a design decision, then what I'm arguing is that it's an unsafe one. I understand the concept being presented that tables start out with all possible keys set to nil, but it doesn't seem worth it to maintain that facade given the drawbacks encountered in practice.

Preston