lua-users home
lua-l archive

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


On Sat, Oct 22, 2011 at 10:16 AM, Sam Roberts <vieuxtech@gmail.com> wrote:
> 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
>
>

The standard libraries of course have the advantage of being standard
and loaded generally into every lua state, and if you're in a position
where you don't need them it's likely you're embedding in which case
you just don't load them. External libraries do not have such
ubiquity.