[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Could require take multiple arguments?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 28 Jan 2016 22:39:48 -0200
> when i think of a multi-parameter `require`, i imagine it as a way to
> pass extra arguments to the required chunk
That would complicate the semantics of `require`, which loads modules
just once per session. Would a different set of extra arguments force
the module to be reloaded?
If you want to pass extra arguments to a module, just write your module as:
private code
return function (...)
code to be run when required
end
and use
function xrequire(m,...)
return require(m)(...)
end