lua-users home
lua-l archive

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


On 27 September 2011 11:36, Dirk Laurie <dpl@sun.ac.za> wrote:
> 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.

Yes I agree that the only advantage would be saving some typing, but I
find myself frequently copying and pasting this kind of code (and I
guess someone else is doing the same :P) so I think it may be worth
considering as proposal.

I think Lua is in general extremely good at allowing a developer to
produce concise code without repeating itself (I find myself learning
new "patterns" for this each day), and the syntax above could
potentially improve on that.

Cheers
KR