If the number of locals must be known at compile time, import() would have to be of the form:
import(io, 'read', 'write', 'setvbuf')
This way the the contents of io would not have to be known at compile-time, and the locals (read, write, setvbuf) would either become references to the associated values in io or nil?
The only problem is I really like the idea of having user-supplied prefix for certain tables.
So if we require that a list of keys for localizing values is always there, it becomes the import(io, { 'read', 'write' }, 'optional_prefix_') form again.
Beyond that... I read Rena's reply and I could see this being potentially convenient:
local tins, trem, tcat = from(table, 'insert, 'remove', 'cat')
That's easy as hell to write in Lua without touching any C... the problem is the user might be inclined to write trem rather than tremove, and third-parties might not understand the obvious shortening. People would be inclined to come up with shorter identifiers with a from() like that..
Adding a pad of unused locals to functions for the purpose of redefining them with an import() is out of the question, that would be an inefficiency of fun proportions. :]
Blah. Save us Roberto, you're our only hope! <3