lua-users home
lua-l archive

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


On Tue, Sep 27, 2011 at 10:33:40AM +0200, Xavier Wang wrote:
> 2011/9/26 Artur Galyamov <artur-pub@yandex.ru>:
> >     local min, max, floor in math
> >
> > No new keywords there. I think it would be nice way to easily localize
> > globals.
> Yes, I like this way, too :)

All that you really gain from that sort of syntax is that you do not
need to type the names min, max, floor twice, since the support for e.g.

    from = require "from"
    local min, max, floor = from.math "min, max, floor"

is easy to write directly in Lua.  And if you want to use other names
than the ones in the library, you lose.

I can see myself using this proposed construction if it is available, 
yes.  But there are so many things I would rather have.   

   1. tuples, i.e. fully internalized immutable lists.
         assert( (1,2,3) == (1,2,3) )
   2. table constructor for keys similar to the one for values, e.g.
         <a,b,c>  is the same as  {a=1,b=2,c=3}
   3. bit rather than bit32 library, operates on numbers or strings
   4. lpeg, lfs to become standard libraries
   5. A table function to go with wish #2:
         table.invert{10,20,30}  is the same as  <10,20,30>
   6. `for k in t do` is OK if non-function 't' has __iter metamethod

Dirk