[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: 'table' as fallback for tables
- From: steve donovan <steve.j.donovan@...>
- Date: Tue, 28 Jun 2016 18:32:52 +0200
On Tue, Jun 28, 2016 at 6:17 PM, Andrew Starks <andrew@starksfam.org> wrote:
> First, `__len` is about sequences and this isn't a sequence. This
> extra metatable is more about making `#(table.pack(...))` work as you
> would *hope* (maybe naively expect, but you'd be wrong) and that is a
> conspicuous amount of fanciness in such an austere language.
A 'conspicuous amount of fanciness' is totally not the Lua spirit ;)
I suspect we're starting to spin around an old familiar whirlpool by
now. It's hard for me to judge, since I like tables and know how to
keep them being sequences. But the 'horror of holes' definitely comes
up with questions from newcomers. It's natural to expect that a table
knows how _big_ it is. The special restrictions of # would then
appear confusing [0]
[0] In a similar vein, a colleague got burned by std::list.size() in
C++ - he assumed it was O(1) but it was O(n)! [1]
[1] fixed since C++11, thank the Goddess...
- References:
- 'table' as fallback for tables, Dirk Laurie
- Re: 'table' as fallback for tables, Tim Hill
- Re: 'table' as fallback for tables, Philipp Janda
- Re: 'table' as fallback for tables, Roberto Ierusalimschy
- Re: 'table' as fallback for tables, Philipp Janda
- Re: 'table' as fallback for tables, Coda Highland
- Re: 'table' as fallback for tables, Jay
- Re: 'table' as fallback for tables, Tim Hill
- Re: 'table' as fallback for tables, Philipp Janda
- Re: 'table' as fallback for tables, Tim Hill
- Re: 'table' as fallback for tables, Adrián Pérez de Castro
- Re: 'table' as fallback for tables, Andrew Starks