[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: New array type? (was: 'table' as fallback for tables)
- From: Dirk Laurie <dirk.laurie@...>
- Date: Fri, 1 Jul 2016 11:37:49 +0200
2016-07-01 9:20 GMT+02:00 Philipp Janda <siffiejoe@gmx.net>:
> Am 01.07.2016 um 07:51 schröbte Dirk Laurie:
>>
>> The desired effect can be achieved by one function in the standard
>> library.
>> That's all.
>
>
> Why does it have to be in the standard library? You can write reasonable
> array implementations in Lua right now.
True. Most of us have something of the kind already, differing
in interface details and with different names. I.e. the wheel is
being reinvented all the time. But that is not the main reason.
The "implementation details" are in fact of cardinal importance.
If the array is in fact kept entirely in the 'array' part, there is
bound to be an improvement in performance.
> This doesn't solve the problem if `#` and the table functions
> continue to accept regular plain tables.
There is no problem if the user obeys the rules.
The user chooses not to use the array option at his own peril.
We seem to have conflicting goals here. I want a fast array
implementation that does not need a calculation every time
I use #, does not need to resize an array except when I ask
it to by calling table.array myself, does not need to take into
account that an element may be in the has part.
What I think you want seems to have some law-enforcing
dimension to it that to my mind violates the spirit of Lua.