lua-users home
lua-l archive

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





On Fri, Aug 1, 2014 at 12:10 PM, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> This is exactly how I would expect a copy function to work without reading
> the documentation. I was surprise to see self-copy as the default.

Maybe the name 'copy' is not good, but we added this function thinking
mostly about self-coping (moving??), for instance as a basis for other
functions like insert and remove (inspired by Laurie's block.move).  The
ability to copy to another table should be a plus, not the main goal.

-- Roberto


This kind of information is really helpful. "Why" you added something is just a little less important than actually adding it, to me. :)

"copy" is an easily understood concept/word that does not allow for transformation. If the primary intent is to provide self-shifitng mechanisms, then perhaps "shift"? "shift" implies integers.

I wonder if people are more likely to use it as "copy" or "self-copy-shift"? That may not be a relevant question to your team. If it is, then perhaps the ordering of arguments, defaults and the name wold follow from that discovery.

Speaking to the function's intended purpose: i have no comment. I've never needed something like that and I'm afraid that I've contributed to a great deal of noise. :)

-Andrew