lua-users home
lua-l archive

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

On 09.01.2011 19:01, Dirk Laurie wrote:
1. I agree with you: it never makes sense to insert nil.
     The fact that the current implementation allows you to make a hole
     that way is a regrettable undocumented feature, caused by a design
     flaw in the API.

I can't agree here. Based on documentation this behavior is the expected one. It is thus documented, but not warned upon as a special dangerous case. I don't see a design flow in API either.

     It would have been less confusing if the three-argument insert
     had the value before the key, so that insert(a,b,nil) means
     insert(a,b) as it would have done if written in pure Lua.  In that
     case it would quite obviously be impossible to insert nil.
     But it is too late now.

It would make no sense IMO. If one wants to append he would use 2 arguments. If 3 arguments are used and the 3rd argument happened to be 'nil' this is most likely an error, maybe an intentional 'nil' insertion, but in no way an attempt to append the second argument.

Best regards,
Sergey Rozhenko