lua-users home
lua-l archive

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


On Thu, May 23, 2013 at 11:57 AM, Thomas Jericke <tjericke@indel.ch> wrote:

>> >>
>> >> So far these concerns don't really align with the unconditional usage
>> >> of modules; dynamism is being preferred where it isn't beneficial.
>> >
>> > I am not sure what your point is. Could you please elaborate?
>>
>> This is unconditional:
>>
>> local t = require("foo")
>>
>> This isn't:
>>
>> if lua_version > 5100 then
>>   local t = require("foo")
>> else
>>  local t = require("bar")
>> end
>
> I got this part, but not your last sentence.
>
>>
>> With import semantics, the bytecode would be larger as it compiles both modules.
>
>
> Hopefully not, the bytecode of modules should still be shared and only compiled once, no need to compile imported modules in each Lua file compilation.

Once per module.

In the example, two distinct modules are beind require()'d.

The cacheing optimization pertaining to multiple inclusions of a given
module is a completely different subject that my example does not
cover...