Packages and modules

Aaron Denney wnoise at ofb.net
Thu Jul 6 07:32:10 EDT 2006


On 2006-07-06, Malcolm Wallace <Malcolm.Wallace at cs.york.ac.uk> wrote:
> John Meacham <john at repetae.net> wrote:
>
>> Package names should never appear in source files IMHO. if a package
>> name is in the source file, then you might as well make it part of the
>> module name.  Packages exist for 'meta-organization' of code. A way to
>> deal with mapping code _outside_ of the language itself, putting
>> packages inside the code will force the creation of yet another level,
>> meta-packages, or something. packages should not be a language issue,
>> they are an environment one.
>
> I tend to the opposite view.  The meaning of the code should be
> expressed in the code itself.  If a module M imports A.B.C, and I can
> see two such modules called A.B.C, then the meaning of the code is
> ambiguous and ill-defined.  I would rather not have to look elsewhere
> (in the build system?  Makefile?  scons?  Cabal file?  DOS batch file?
> where?) to find out how to resolve the ambiguity.  Surely the programmer
> knew which import was intended.  Is it so difficult to communicate that
> information somewhere close to the import itself?

Then, as John points out, how is package Foo module A.B.C and package
Bar module A.B.C any different than modules Foo.A.B.C and Bar.A.B.C?

(And I agree with Ketil about when it is useful to specify this outside
the source, unlike your flag example.)

-- 
Aaron Denney
-><-



More information about the Libraries mailing list