lua-users home
lua-l archive

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


On Sun, May 10, 2009 at 9:36 PM, Flemming Madsen <lua@themadsens.dk> wrote:
> Great piece of work! Just the batteries needed for our platform.

Thanks - that was the idea!

> 1) Why not return the list from all calls that would not otherwise
> return anything?
>   This would let one write eg. L:clear():extend({3,2,1}):sort() as noted elsewhere

A good idea

> 2) Include all table operations. One should be able to write L:concat('\t'), not
>   table.concat(L, '\t')

Now that is something I've been considering, although that particular
operation is now L;join '\n', which may be confusing. Mixing up my
languages?

> 3) Related to the above, methods *really* should have the same meaning as the
>   table operation of the same name. L:remove(2) should not be
> something completely  different from table.remove(L, 2)! I appreciate the python
> heritage, but this is Lua

Yes, exactly. List was intended to reproduce the Python interface, and
remove has a very definite meaning in Lua. Perhaps the current meaning
should be expressed as L:remove_value(2) ?

> I have included a patch that implements the above. A 'return self' is
> thrown in at numerous places. Remove is renamed to purge, and remove
> is now an alias for pop. Delete is like remove but returns the list
> removed from.
> Also there is a fix in pretty.write so it wont throw away numerix
> indexes > #t :)
>

Thanks, I'm deep into the next release cycle, and this is exactly the
kind of feedback I need. pretty.write is currently irritating me, and
I'm trying for something really pretty, like:
{
  {1,2,3},
  {3,4,5}
}

instead of throwing in all those linefeeds.

steve d.