[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lexical environments
- From: Alexander Gladysh <agladysh@...>
- Date: Thu, 4 Feb 2010 10:31:16 +0300
> As apealing as it looks, I wouldn't want to have such a syntax such as
> local x,y from vector
> The reason is, that this keyword seems useless to me beyond the purpose it
> was intended for (loading values from a table into the local scope).
> What I like about Lua is that there are only a few concepts with a wide
> variety of applications. To me, this feature looks really neat - but not
I have a lot of code, which imports its dependencies like this:
= import 'path/to/file.lua'
Note that import names are usually longer than three letters, so
import spans several lines. Also, some files have many dependencies.
So, being able to write
= from import 'path/to/file.lua' ( )
would be really nice.
Looks like that this way all my import would have to do is to require
requested file. This is nice as well. (I assume that "from" would fail
if "symbol" is not found.)
It would be cool if from would have some virtualization mechanisms
(like __from metamethod on the table we import from — but then,
probably, __index would do). After all, it would be the *first* way to
do something unusual with locals in Lua.