lua-users home
lua-l archive

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


On Tue, Apr 8, 2014 at 12:51 PM, Christopher Berardi
<cberardi32@gmail.com> wrote:
>         import module1
>         local import module2

The first form could be implemented simply as a function, since it
just involves a loop at run-time copying key,value pairs from the
require'd module into _G.

The second form has to expand at compile-time, and in general this
isn't possible, because we don't know what the contents of 'module2'
are at compile-time.

> And the same for getting sub-modules
>
>   import func1, func2 from module4
>   local import func3, func4 from module5

I doubt there's any need for the first form here - the second form can
be implemented at compile-time (or macro expand time) because the
names are specified.

One way of evaluating a proposal is to think of documenting it, and I
think it's going to take a fair amount of text to explain this all....

It's matter of what's easy to type and what's easy to read;  if the
typing is a problem, teach your editor to do the expansion, if reading
is a problem..... well, then I don't know..  Personally I don't see
the problem with reading explicit code. This feels like an attempt to
impose another language's semantics onto Lua - as well as syntax.