lua-users home
lua-l archive

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


On 22 January 2018 at 05:08, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> 2018-01-22 4:36 GMT+02:00 KHMan <keinhong@gmail.com>:
>
> I use stock Lua as my hammer for everyday tasks [1]. What counts is the
> number of minutes it takes from when I sit down to when I have the results.
> Several things contribute to those minutes:
>
> 1. Typing in the code.
> 2. Thinking while I type.
> 3. Consulting the manual.
> 4. Running the code.
> 5. Debugging
>
> I find that having only one data structure cuts down on items 2 and 3.
> I also find that if item 4 contributes significantly, then I have not really
> understood the problem yet (or it is really very tough).
>

Sure. For others though having a single data structure that has
unexpected semantics as Lua has for sequences, it can lead to more
work and more debugging. I am one of those few people perhaps who
started in Lua before learning Python. In my mind, Python is the more
'user friendly' language and Lua the more 'geek friendly'. However,
keeping aside language design issues, Lua's strength is its size and
approachability for anyone wanting to play with the language
implementation.

> I also find that I think about my problem in terms of Lua tables.
> It's the rule rather than the exception that my tables conceptually
> have a sequential part and a hash part, and I would find it a pain
> to translate my code into a language that does not support
> Lua's model of a table as a mapping from almost any Lua
> value to almost any other Lua value.
>
> Roberto said the other day that tables are the bread-and-butter
> of Lua, and if we demonize them, there is nothing left. Amen.
>

To be honest it is possible to have an array subtype of table in Lua
without breaking backward compatibility or taking away from users who
just wish to use tables, as I explained in another post. Very much
like having an integer subtype for numbers. But I don't think it will
happen.

Regards
Dibyendu