lua-users home
lua-l archive

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




On Tuesday, April 8, 2014, Christopher Berardi <cberardi32@gmail.com> wrote:

On Apr 8, 2014 10:31 AM, "steve donovan" <steve.j.donovan@gmail.com> wrote:
>
> On Tue, Apr 8, 2014 at 3:31 PM, Coroutines <coroutines@gmail.com> wrote:
> > Your last statement frustrates me.  I could see "new syntax" being scary,
> > but another languages' semantics?  Are you kidding?  How is it another
> > language to essentially pull in references in batch from one table to
> > another?
>
> It ain't crap, it's just how Lua resolves symbol references; either
> they are in the environment or they are locals.  'local import foo' is
> impossible with Lua semantics, because each new local slot has to be
> allocated at compile time, and we don't _know_ what foo contains.

Maybe I'm missing something, but you I don't think you should need to the contents at compile time. You have the name of the local variable which should be enough. I'm certainly not advocating automatically creating a variable for each element of the loaded module.

For example, this should be how it would work:

    local import module1
    module1.func1()

And not:

    local import module1
    func1()


Can you guys move this to a new thread, please?