[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: One more item to the collection of Lua hate-speech
- From: Henk Boom <henk@...>
- Date: Fri, 9 Jul 2010 14:41:07 -0400
On 9 July 2010 04:45, Fabien <fleutot+lua@gmail.com> wrote:
> On Fri, Jul 9, 2010 at 12:16 AM, Henk Boom <henk@henk.ca> wrote:
>>
>> IMO explicit declarations are a good thing because they clarify
>> scopes. I would love for all variables would be statically and
>> lexically scoped, so that the compiler could generate compile-time
>> error messages for undeclared variables. That requires that you be
>> able to statically determine module imports, though. (maybe it could
>> be done with metalua)
>
> Not reliably: since require() is a regular function call on a regular global
> var, it can be constructed in arbitrarily complex ways:
> add_r = |x| 'r' .. x
> getfenv()[add_r 'equire'] 'imported_module'
> But rebuilding a dependency graph based on occurrences of global 'require'
> is not difficult, and has already been done, including in at least one
> commercial product.
I was thinking of replacing require with a macro which would declare
static variables for imported names, something like the way PLT-Scheme
does it. It requires that you know what names a serving module
provides when you're compiling the client module though.
henk
- References:
- One more item to the collection of Lua hate-speech, Alexander Gladysh
- Re: One more item to the collection of Lua hate-speech, Luiz Henrique de Figueiredo
- Re: One more item to the collection of Lua hate-speech, Petite Abeille
- Re: One more item to the collection of Lua hate-speech, Wim Couwenberg
- Re: One more item to the collection of Lua hate-speech, Mark Hamburg
- Re: One more item to the collection of Lua hate-speech, Mark Hamburg
- Re: One more item to the collection of Lua hate-speech, Roberto Ierusalimschy
- Re: One more item to the collection of Lua hate-speech, Geoff Leyland
- Re: One more item to the collection of Lua hate-speech, Roberto Ierusalimschy
- Re: One more item to the collection of Lua hate-speech, RJ Russell
- Re: One more item to the collection of Lua hate-speech, Henk Boom
- Re: One more item to the collection of Lua hate-speech, Fabien