Changes between Version 1 and Version 2 of Commentary/Packages/GhcPackagesProposal


Ignore:
Timestamp:
Jun 26, 2006 10:52:03 AM (9 years ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Packages/GhcPackagesProposal

    v1 v2  
    1111 * a module name must be unique within its package (only)
    1212
    13 That means that module A.B.C could exist *both* in package P1 and in P2. And both packages could be linked into the same program. You would say
     13That means that module A.B.C could exist *both* in package P1 and in P2. And both packages could be linked into the same program. Suppose for the moment that A.B.C is not exposed by both P1 and P2.  Then you would say simply:
     14{{{
     15  ghc --make Main -o app
     16}}}
     17Note the late binding here.  The authors of packages P1 and P2 didn't need to know about each other, and don't need to choose globally unique names.
     18
     19Things are a bit more complicated if both P1 and P2 expose A.B.C, because then "{{{import A.B.C}}}" is ambiguous. Then it's unlikely that both P1 and P2 are exposed packages, and you'll need to bring them into scope explicitly:
    1420{{{
    1521  ghc -c -package P1 M1.hs
     
    1824  ghc -o app M1.o M2.o ... -package P1 -package P2
    1925}}}
    20 Note the late binding here.  The authors of packages P1 and P2 didn't need to know about each other, and don't need to choose globally unique names.
    21 
    22 To support {{{--make}}} we'd need to allow {{{-package}}} flags in the per-module {{{OPTIONS}}} pragmas; and we'd need to gather those options together for the link step.
     26To support {{{--make}}} in this situation we'd need to allow {{{-package}}} flags in the per-module {{{OPTIONS}}} pragmas.  ({{{ghc --make}}} already gathers those options together for the link step.)
    2327
    2428The fundamental thing GHC needs to do is to include the package name into the names of entities the package defines.  That means that when compiling a module M you must say what package it is part of: