[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Quest: real world "Lua array with holes" usage
- From: Tim Hill <drtimhill@...>
- Date: Sat, 30 Jul 2016 13:50:34 -0700
> On Jul 29, 2016, at 12:34 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>
> 2016-07-29 8:20 GMT+02:00 Thomas Jericke <tjericke@indel.ch>:
>
>> Anyway I am currently think {(1, 2, 3)} is the more intuitive array
>> constructor syntax. This because (1, 2, 3) is already the syntax for an
>> argument list.
>> To me {(1, 2, 3)} reads like: I have this list here that you should back me
>> into a table please.
>
> The most intuitive array constructor syntax is
>
> Array{1,2,3}
>
The trouble is this is inefficient. Lua has to construct a regular table, then pass it to the Array() function, which (presumably) then copies the content to an array (how?) .. and then later the first array is GCed. Not good if you repeat 10,000 times. Unless of course you intend to coerce the table in-place into an array, which is not very constructor-y.
—Tim
- References:
- Quest: real world "Lua array with holes" usage, Rodrigo Azevedo
- Re: Quest: real world "Lua array with holes" usage, Roberto Ierusalimschy
- Re: Quest: real world "Lua array with holes" usage, Jorge
- Re: Quest: real world "Lua array with holes" usage, Hisham
- Re: Quest: real world "Lua array with holes" usage, Roberto Ierusalimschy
- Re: Quest: real world "Lua array with holes" usage, Tim Hill
- Re: Quest: real world "Lua array with holes" usage, Hisham
- Re: Quest: real world "Lua array with holes" usage, Thomas Jericke
- Re: Quest: real world "Lua array with holes" usage, Tim Hill
- Re: Quest: real world "Lua array with holes" usage, Thomas Jericke
- Re: Quest: real world "Lua array with holes" usage, Dirk Laurie
- Re: Quest: real world "Lua array with holes" usage, Thomas Jericke
- Re: Quest: real world "Lua array with holes" usage, Dirk Laurie
- Re: Quest: real world "Lua array with holes" usage, Thomas Jericke
- Re: Quest: real world "Lua array with holes" usage, Tim Hill
- Re: Quest: real world "Lua array with holes" usage, Thomas Jericke
- Re: Quest: real world "Lua array with holes" usage, Dirk Laurie