[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.3.0 (alpha) now available
- From: Coda Highland <chighland@...>
- Date: Thu, 31 Jul 2014 12:25:06 -0700
On Thu, Jul 31, 2014 at 12:00 PM, Coroutines <coroutines@gmail.com> wrote:
> See I thought the reverse -- if you plan to use the 'table' library
> for your own supertype of tables, you'd want the first argument to be
> the destination, so you can do: some_table:copy(source, ...) --
> some_table being the destination, the table copied into
Here, we disagree: If you didn't pass any parameters, you would expect
some_table:copy() to return a copy of some_table -- that is to say,
some_table is the source. I would find the behavior unintuitive if it
were otherwise.
Essentially, I read "copy" in this context as "copy_into". A
"pull"-type operation would be... I don't know, "fill" or something.
Maybe "copy_from". Not an unadorned "copy" for sure.
That said, the syntax of table.copy here... I'll have to agree that
it's not exactly intuitive. I'm not sure how to improve it, except
that I think perhaps "move" might be a better name overall if it's
possible for (source, first, end, target) to have target be between
first and end. (c.f. memmove())
/s/ Adam