[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: New array type? (was: 'table' as fallback for tables)
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 7 Jul 2016 09:26:05 +0200
On Thu, Jul 7, 2016 at 9:15 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
> give credit where credit is due, but the following ideas for fixed-length
> tables seem to be useful enough to keep in mind.
It seems a specialized case to me?
> 1. The __len metafield could contain an integer, not a function.
But that makes sense...
> 2. That could be used to flag the table as a fixed-length array
> that may contain nils.
OK, I see, like varargs...
> 3. Supply __newindex metamethod if you want to treat an assignment
> outside the range of a fixed-length table as an error.
> 4. This will automatically cause table.insert to be an error.
> 5. The semantics of table.insert could be revised so that in the case
> of a fixed-length table, no assigment beyond __len is made, but an
> error is signalled if the last element is not nil.
> 6. Automatic resizing of a fixed-length array could be replaced
> by doing it only on request (e.g. a function table.resize).
OK, I do see the point. This will cover most of the cases.
- References:
- Re: New array type? (was: 'table' as fallback for tables), Jonathan Goble
- Re: New array type? (was: 'table' as fallback for tables), Philipp Janda
- Re: New array type? (was: 'table' as fallback for tables), steve donovan
- Re: New array type? (was: 'table' as fallback for tables), Philipp Janda
- Re: New array type? (was: 'table' as fallback for tables), steve donovan
- Re: New array type? (was: 'table' as fallback for tables), Hisham
- Re: New array type? (was: 'table' as fallback for tables), steve donovan
- Re: New array type? (was: 'table' as fallback for tables), steve donovan
- Re: New array type? (was: 'table' as fallback for tables), Soni L.
- Re: New array type? (was: 'table' as fallback for tables), Tim Hill
- Re: New array type? (was: 'table' as fallback for tables), Soni L.
- Re: New array type? (was: 'table' as fallback for tables), Tim Hill
- Re: New array type? (was: 'table' as fallback for tables), Coda Highland
- Re: New array type? (was: 'table' as fallback for tables), steve donovan
- Re: New array type? (was: 'table' as fallback for tables), Dirk Laurie