lua-users home
lua-l archive

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


2013/5/18 Dirk Laurie <dirk.laurie@gmail.com>:
> Often on this list voices have gone up proposing a language addition
> that would allow one to automate the following process:
>
>     local concat,insert,remove,pack,sort,unpack=
>        table.concat, table.insert, table.remove, table.pack,
>        table.sort, table.unpack
>
> by saying Pythonically
>
>     from table import *
>
> or whatever.  Has anybody ever actually produced a kernel patch that
> implements something of the kind?

After five days, the answer seems to be "No, because it is impossible."

The opposite task is easier: to automate

   mymod = {func1=func1, func2=func2, ... }

That can be done easily enough by an appropriate script that processes

   io.open(debug.getinfo(1).source:match"@(.*)"):read"*a"

provided that certain conventions are followed.