lua-users home
lua-l archive

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


On 9 May 2010 11:36, Klaus Ripke <paul-lua@malete.org> wrote:
Could indexing anything but a table, or at least indexing nil,
return nil instead of throwing an error?
I don't see why x.z conveniently gives nil, if there is no z in x,
but x.y.z requires an extra check for x.y .
This makes working with structures with lots of optional parts pretty
tedious - and if it's external input, basically everything is optional.

Really I'd love to see nil behave like an empty value of
the expected type most of the time, Perl style.

I have to say that nil.abc (and nil(abc), and nil + 1) throwing an error is how many of my bugs are caught.

    henk