[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: modules, require, magic
- From: Sam Roberts <vieuxtech@...>
- Date: Fri, 21 Oct 2011 16:16:30 -0700
On Fri, Oct 21, 2011 at 12:54 PM, Luiz Henrique de Figueiredo
<lhf@tecgraf.puc-rio.br> wrote:
>> we don't have to do a require"io" or require"table" before using them
>
> But you *can* do the requires. So, if you feel better using them, by all
> means do it.
Writing code that does nothing doesn't make me feel better.
Its a null OP, nobody does it, and in the rare lua environments where
it actually did load the table module, it would cause it to be
injected into the global namespace, would it not?
So, the standard lua modules display the "pollution" problem that the
5.1 module() function is being criticized for.
If you don't like modules to be implicitly created as globals by
require, then in lua 5.2 this should be true:
assert(not string)
local s = require"string"
assert(not string)
assert(s.gsub)
Cheers,
Sam
- References:
- modules, require, magic, Eduardo Ochs
- Re: modules, require, magic, Javier Guerra Giraldez
- Re: modules, require, magic, Petite Abeille
- Re: modules, require, magic, Sam Roberts
- Re: modules, require, magic, David Manura
- Re: modules, require, magic, Mark Hamburg
- Re: modules, require, magic, Sam Roberts
- Re: modules, require, magic, Luiz Henrique de Figueiredo