lua-users home
lua-l archive

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


On Tue, Apr 24, 2012 at 9:47 AM, Miles Bader <miles@gnu.org> wrote:
> I make local aliases for table functions, I usually do use a term like
> "array" ("local array_delete = table.remove").

My favourite alias is 'local append = table.insert', seems to appear
at the start of just about any code I write.

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.

Easily done in plain Lua of course, and I wonder if a review of
microlight would be useful.  There the logic gets wrapped in the Array
class, but I note that it does not do bounds checking - could at least
be an option.

steve d.