lua-users home
lua-l archive

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


hi friends


as it was a rather quiet time on lua-l recently
and especially with regard to 5.2 whishes,
I feel like reraising a few FAQs, forgive me.


Could x[] be syntactic sugar for x[#x+1] ?
It would make appending to lists so much nicer.


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.

Does anybody rely on all these errors being raised?
Wouldn't that be poor style anyway?
If you really want that, there's stil assert to make that clear, no?
Doesn't the fact that you use x in an index operation,
concat, format %s or whatever whithout checking for nil
pretty clearly state that you want that operation to work,
somehow?
I'd so love to get rid of all that (x or '') everywhere.


best
Klaus