lua-users home
lua-l archive

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




On 16/03/17 08:52 AM, Chris Jones wrote:
Hey

On 16 March 2017 at 02:09, Hisham <h@hisham.hm <mailto:h@hisham.hm>> wrote:

    Do I think `table.insert` is too long? Yes I do, I wouldn't mind
    having a shorter idiom (many were proposed here over the years, most
    of them were fine, but I'm not getting into them because we risk
    delving into syntactic bikeshedding again, so let's avoid that).


I've always been curious what the reasoning is for not having all of the table functions, as methods on table objects.

    Do I think it's worth it to add `local tinsert = table.insert` to
    every program? No, because I hate having to guess which abbreviation
    the module author used to write a shorter `table.insert` in their code


Yes, a thousand times this. I've accepted far too much code into Hammerspoon from people who know Lua better than I do, with this stuff in.

I do `local tinsert = table.insert` for performance.


Combined with the apparent allergy to whitespace that many Lua coders have, it makes for code that is excruciatingly hard to read/debug!

--
Cheers,

Chris

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.