lua-users home
lua-l archive

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

On Mon, 20 Sep 2004, Roberto Ierusalimschy wrote:

why shouldn't independently-distributed modules providing related
functionality be grouped into a package (and even require one another)?

What about "A *package* is a collection of interrelated modules"?

How about allowing modules to be packages? You already talk about hierarchically defined modules in the spec.

The "one file = one module" rule is arbitrary and wrong. Most
languages with a decent module system don't have it.

Python has it hardcoded. Perl allows a package to be defined in several
files, but there is no standard way to load such a package. (I am not
sure whether they qualify as "languages with a decent module system",
but there are few complains about their module systems.) In Lua, too,
you will be able to spread a module through several files (and even to
define several modules in one file), but there is no standard way to
import such modules.

I agree that Python and Perl are not obviously "languages with decent module systems". I suppose I'm not against a module needing to be loaded from a single file, I'm just against it being restricted to a single file. Having a file that you load in order to load the module is fine (and then it's up to that file how it gets the other pieces).

I think, all in all, this proposal suffers from feature bloat. [...]
The CPAN model might offer some lessons here:

Which feature in this proposal are not present in Perl? (Ok, the stuff
about C modules and preloaded modules are not present in Perl, but Perl
almost do not use C modules.) Which specific feature do you think we
should remove?

Actually, on a second reading, it seems that most of the detail in the Lua proposal is there because it can be, because Lua is already more regular than Perl. The irregularities seem mostly to do with dealing with compiled code, which, as you say, Perl doesn't have to worry about so much; and it IS useful to be able to load compiled or linked code directly without needing a Lua header (or is it? if you required a Lua header for all compiled or linked code, would this make the proposal simpler?).

There's also one small thing, the way you allow | or ; as equivalent separators. This is logical but confusing. There are enough other places in Lua with this sort of confusion (mostly for syntactic sugar reasons); adding further syntactic alternatives should be avoided.

-- | violence, n.  bravery for cowards