|
On 20/02/2012 5:56 PM, steve donovan wrote:
(There is a temptation to game the system and overload functions too much. table.insert is already a standard function which is really two functions, insert() and append())
Do you think table.insert should be taken as a guide that "Lua style" function design is to overload things in semantically confusing ways? Is there really an benefit for conflating insert() and append().
I remember when I first started using lua the lack of an append function was very confusing. I had to work out how to implement it, and I din't find insert() until later, instead opting for something like x[#x]=y
The reason I ask is that if there is a "Lua way" with these things it should guide the library design -- even if it seems strange. No point trying to have a pythonic library if the lua core library doesn't behave that way.
Otherwise I shall mount a campaign for behavioral clarity and the separation of insert() and append() -- as would be normal in the rest of my world ;)
Ross.