3 Jul 2006 18:45
RE: Packages and modules
Simon Peyton-Jones <simonpj <at> microsoft.com>
2006-07-03 16:45:38 GMT
2006-07-03 16:45:38 GMT
Concerning packages, Alex asks: | We covered this extensively in the Cabal vs Haskell thread starting | here: http://www.haskell.org//pipermail/libraries/2005-April/003607.html | | You concluded it by saying on April 22: | | And this observation points towards a simpler solution: rather than | invisibly pre-pend the package name, just get the programmer to do so. | So package P exposes a module called P.M and package Q exposes Q.M. All | P's internal modules are called P.something, and similarly for Q. (We | rely on some social mechanism for allocating new package names, as now.) | Now of course you can import P.M and Q.M in a single module. | | That would be simple. It might be pretty inconvenient to say 'import | Base.Data.List' rather than just 'import Data.List'. But nothing forces | you to do this -- and indeed we don't do it for the current 'base' | package. The point is that it's an easy way for a package author to | ensure their package won't conflict with others. If they choose not to | avail themselves of it, it's more likely that their package will be | unusable because of accidental name conflicts.(Continue reading)
I think the following is a non-question:
An open question: if A.B.C is in the package being compiled,
and in an exposed package, and you say import A.B.C,
do you get an error ("ambiguous import"), or does the current
package override.
because if the suggested syntax is used, import directives come in two
flavours: ones that use "from" to import from a different package and ones
that don't use "from" and therefore must refer to the current package. There
would be no such thing as an "exposed" package (afaiu the idea of "exposure"
is only needed in the context of different packages needing to share the
same module namespace, which the proposal will hopefully make a thing of the
past).
Here are some other points:
1) What is the meaning of A.B.C.id ?
I think this would have to refer to id in the module A.B.C in the package
being compiled. To refer to an id in some other package, you'd have to use
an alias eg
RSS Feed