lua-users home
lua-l archive

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


On Tue, Oct 9, 2012 at 5:23 PM, Thijs Schreijer <thijs@thijsschreijer.nl> wrote:
>> (For the argument of "let's just everyone use foo/init.lua and avoid
>> foo.lua instead", the fact that ?.lua takes precedence means that it is
>> a more robust option; besides, many projects consist of a single
>> file.)
>
> My personal preference is to let ?/?.lua have precedence of ?.lua, simply to keep the higher level directory clean.

I like clean directories too, but that's not the default behavior of
package.path, which doesn't even feature ?/?.lua as an option.

> All module related files (even if its only 1) reside in their own sub directory. It is not namespacing, but close to it and easy to achieve. So imo that is the more robust option.

Robustness does not refer to which is the cleanest-looking, but to
which option is more resilient to different environments. I
specifically called it more robust because ?.lua is the option that is
more guaranteed to work correctly with default installations of Lua
(vanilla build from source code, various packages from package
managers, etc.).

Given a custom environment, one can of course do any customizations
according to their personal preferences. My comment was just about
what's better suited to be used as a default when shipping a module
for others to use.

Cheers,

-- Hisham
http://hisham.hm/