lua-users home
lua-l archive

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


	Hi Gustavo

- It'd be nice if "requires" could tell the executed module where it was
  found somehow (e.g. _FILE).  Knowing where the module was found during
  its execution allows implementing location-specific behavior (e.g.
  read a template or whatever from the same place).
	For reading a template, the module could just invoke
require"package.module.template".  The template should be found
the same way the module is.

- module() seems a bit tricky to deal with.  I've specifically stumbled
  upon the fact that it either hides the global environment, or it pollutes
  the module namespace (with package.seeall).  I've also missed the "import
  locality" common in other languages; in Lua, if one module requires
  something, everything else can see the same module.  I'm trying to
  invent some conventions to minimize these details, but it'd of course be
  awesome to have the standard mechanism dealing with it, as it'd encourage
  good practices by default.
	I usually do:

local mydependency = require"mydependency"

	Or even:

local func_dependency = require"mydependency".func

	The names are just illustrative :-)  Does it solve your
problem?

	Regards,
		Tomás