lua-users home
lua-l archive

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


> On Oct 18, 2011, at 9:48 PM, Krunal Rao wrote:
>
>> What is wrong with having modules defined as Luiz and Mike (and others) suggest:
>
> Contrast "15.2 The Basic Approach for Writing Modules" vs. "15.3 Using Environments" vs. "15.4 The module Function"
>
> http://www.inf.puc-rio.br/~roberto/pil2/chapter15.pdf

Yes, I am aware of what is written in PIL (I own a copy of the book).

I think this is a situation where experience and use has shown that an
alternative approach (the basic one) preferable.

Apart from "concentrating everything all module related functionality"
(i.e. avoiding the return _M) I do not see other clear advantages in
the module approach.

In a sense I would phrase the question as: what is wrong / needs to be
improved with the approach I mention above that requires additional
code / functionality?

I understand that code have been written according to the module()
function pattern, but Lua 5.2 breaks compatibility in other ways as
well...

KR