[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.3.0 (alpha) now available
- From: Patrick Donnelly <batrick@...>
- Date: Fri, 1 Aug 2014 11:38:42 -0400
On Fri, Aug 1, 2014 at 11:34 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2014-08-01 17:15 GMT+02:00 Daurnimator <quae@daurnimator.com>:
>> On 1 August 2014 10:48, Roberto Ierusalimschy <roberto@inf.puc-rio.br>
>> wrote:
>>>
>>> > [...] However, I am not delighted
>>> > by an optional argument preceding a non-optional one. [...]
>>>
>>> We do not like it either. Do you suggest any alternative?
>>>
>>> -- Roberto
>>>
>>
>> I see no problem saying making the function signature
>>
>> table.icopy(from_tbl, from_idx, num_elements, [to_tbl, to_idx])
>>
>> If to_tbl and to_idx ar not given, they default to the empty table and 1.
>> The function always returns to_tbl.
>
> I like this, but why not
>
> table.icopy(from_tbl[, from_idx, num_elements[, to_tbl, to_idx]])
>
> with from_idx, num_elements defaulting to 1,#from_tbl? Then
> sequence cloning is simply
>
> to_tbl = table.icopy(from_tbl)
How about:
table.icopy(from_tbl [, from_idx [, num_elements [, to_tbl [, to_idx ]]]])
Defaults:
from_idx = 1
num_elements = #from_tbl
to_tbl = {}
to_idx = #to_tbl
Can we go deeper? :)
--
Patrick Donnelly