lua-users home
lua-l archive

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


On 8/24/12 3:09 PM, Duncan Cross wrote:
> On Fri, Aug 24, 2012 at 1:53 PM, Rob Hoelz <rob@hoelz.ro> wrote:
>> Hello fellow Lua users,
>>
>> Over my experience reading e-mails on this mailing list, as well as
>> helping people on #lua, I've decided to write a library that implements
>> and enhances the functionality of require().
>> I have snippets of code from over the years, so the work will really
>> just be assembling them into something useful and coherent.
> Hi Rob. Interesting idea! Thanks for sharing it.
>
>>   -- Loading modules with arguments
>>
>>   require('foo.with.config', { ... }) -- the arguments are passed
>> directly to the chunk
>>
>> I've seen this requested a few times, and I've also wished for it in my
>> own modules.
> So how does this work, given that normally the module table is stored
> and returned each time that require() is called -- does the loader now
> get re-run each time instead, or are arguments ignored after the first
> time, or what?
Excellent question!  I think that the extra arguments feature would
mainly be used as a configuration mechanism, and authors of modules
utilizing the feature would have to do so
under the understanding that the chunk is only evaluated once.
>
>> The feedback I really want to get is regarding the name.  'robs.require'
>> is a terrible name, and I'm open to suggestions.  I just suck at naming
>> things. =)
> How about something like 'necessity'?
>
> -Duncan
>