[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.2 Length Operator and tables (bug?)
- From: Miles Bader <miles@...>
- Date: Tue, 24 Apr 2012 17:25:37 +0900
steve donovan <steve.j.donovan@gmail.com> writes:
> Just naming 'table' to 'array' might let people into thinking that
> array.insert and array.remove preserve the magic state of
> Non-Holiness that we aspire to in our arrays. They should be
> separate functions; add an array.issequence predicate and then
> define them to be safe and fail noisily otherwise.
AFAICT, "array.issequence" would be a bit expensive (always requiring
a complete scan over the table, whereas insert/delete may not need one
when operating near the end), and calling it the insert/remove
functions would certainly be kind of un-Lua-ey; if the functionality
is made more clear with different names, I think that's enough.
[If people want to call these (more clearly named) functions with
something they're not sure is a real array/sequence, they can always
do the check themselves.]
The current state is sort of like the joke with the doctor saying
"well don't do that then"; if the table module were called "array" or
"seq", it'd be more like "well don't do that then, didn't you notice
the giant warning label?!" While some people may sympathize with the
patient in the former case ("Maybe he didn't know..."), it's a bit
more difficult in the latter...
-miles
--
Christian, n. One who follows the teachings of Christ so long as they
are not inconsistent with a life of sin.
- References:
- Re: Lua 5.2 Length Operator and tables (bug?), Joseph Manning
- Re: Lua 5.2 Length Operator and tables (bug?), Coda Highland
- Re: Lua 5.2 Length Operator and tables (bug?), Dirk Laurie
- Re: Lua 5.2 Length Operator and tables (bug?), Coda Highland
- Re: Lua 5.2 Length Operator and tables (bug?), joao lobato
- Re: Lua 5.2 Length Operator and tables (bug?), Coda Highland
- Re: Lua 5.2 Length Operator and tables (bug?), joao lobato
- Re: Lua 5.2 Length Operator and tables (bug?), Eduardo Ochs
- Re: Lua 5.2 Length Operator and tables (bug?), Roberto Ierusalimschy
- Re: Lua 5.2 Length Operator and tables (bug?), Petite Abeille
- Re: Lua 5.2 Length Operator and tables (bug?), Roberto Ierusalimschy
- Re: Lua 5.2 Length Operator and tables (bug?), Petite Abeille
- Re: Lua 5.2 Length Operator and tables (bug?), Petite Abeille
- Re: Lua 5.2 Length Operator and tables (bug?), Petite Abeille
- Re: Lua 5.2 Length Operator and tables (bug?), Axel Kittenberger
- Re: Lua 5.2 Length Operator and tables (bug?), Javier Guerra Giraldez
- Re: Lua 5.2 Length Operator and tables (bug?), steve donovan
- Re: Lua 5.2 Length Operator and tables (bug?), Rena
- Re: Lua 5.2 Length Operator and tables (bug?), Miles Bader
- Re: Lua 5.2 Length Operator and tables (bug?), steve donovan