lua-users home
lua-l archive

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


It's an implementation detail that bleeds through into userland big time, though. From the pairs()/ipairs() distinction through to the way table sizes are calculated (which I believe was the thing that set off this discussion in the first place).

On the one hand I totally understand where the resistance is coming from, but on the other hand it's one of these fundamental decisions that are a big source of WTFs for new users. Of course experienced devs reflexively code around it and never encounter any problems.

Personally, my take-away from this when I learned Lua was to just not use numerical indices anywhere - and with iterators that works out just fine. But it's a gotcha.

My reason for _not_ keeping these thoughts to myself was the impression that this is a speculative thread, not an actual feature request.

On Thu, Sep 18, 2014 at 2:22 PM, Coda Highland <chighland@gmail.com> wrote:
On Thu, Sep 18, 2014 at 3:42 AM, Udo Schroeter <udo.schroeter@gmail.com> wrote:
> Option a) Keep the distinction between the hash part and the array part,

You can't exactly keep a distinction that doesn't exist in the first
place. Keep in mind that the concepts of "hash part" and "array part"
are implementation details -- the "array part" is a behind-the-scenes
optimization to make a very common use case faster.

As such, I fail to see how either option actually differs from how Lua
behaves right now.

/s/ Adam