RE: Libraries and hierarchies

Yes. I would have thought that library authors would want to avoid this. I guess you don't mind: the library user just grafts one of the libraries in somewhere else. So the mapping supplied with the package is presumably just a default that can be overridden. And to read someone else's source code I also need their personalized mappings for the various packages they're using.
So you have extended the syntax of the language: you need a syntax for these mappings, and the static semantics operates on ordinary source plus this mapping language.
Thinking about it, I'm not sure that the language definition needs to be extended at all, to allow the proposed scheme. The language definition (with hierarchical modules, of course) continues to specify the meaning of a collection of modules, each with an absolute module name. What we are proposing is two mechanisms that the compilation system can provide so that the user has more flexibility in constructing a set of modules with absolute names. 1. A method by which a module can change its module name after being compiled. 2. A method by which a module can be exposed as several absolute module names to future compilations. I think these could be expressed as source-to-source transformations, leaving the Haskell 98 + hierarchical modules spec as it is. What about the mappings between packages and sites? Don't we need to specify a syntax for these, and include it in the language spec? I don't think so. This is all just a facility provided by the compilation system for populating the module namespace with modules - we don't need to add it to the language, in the same way that we don't need to include search paths and filenames in the language. This is something of a technicality I suppose, but it's nice to know that the language spec can remain unchanged. It's also useful to cleanly separate the meaning of a program as a set of modules, from the means by which we arrive at that set of modules. Cheers, Simon

On Fri, Aug 08, 2003 at 09:33:23AM +0100, Simon Marlow wrote:
Thinking about it, I'm not sure that the language definition needs to be extended at all, to allow the proposed scheme.
The language definition (with hierarchical modules, of course) continues to specify the meaning of a collection of modules, each with an absolute module name. What we are proposing is two mechanisms that the compilation system can provide so that the user has more flexibility in constructing a set of modules with absolute names.
1. A method by which a module can change its module name after being compiled.
2. A method by which a module can be exposed as several absolute module names to future compilations.
I think these could be expressed as source-to-source transformations, leaving the Haskell 98 + hierarchical modules spec as it is.
I may be misunderstanding the transformations you have in mind, but how do I tell whether A.B.C.f and X.C.f are the same thing? Also, suppose I have the documentation for someone's package, and I'm looking at a program that uses that package, but grafted in at some unknown point in the hierarchy. How do I understand that program? This seems quite different from search paths; all that matters is the text of the modules concerned, not their location in the file system.

I think I share Ross's sense that this is (or should be) a language extension with a significant semantic change
I may be misunderstanding the transformations you have in mind, but how do I tell whether A.B.C.f and X.C.f are the same thing?
The gist of the transformations is expressed by the following cpp definitions: #define A.B Posix-pkg-1.0.Posix #define X Posix-pkg-1.0.Posix where posix-pkg-1.0.Posix is the true name of the module and A.B and X are the synonyms. (Of course, cpp is too crude a tool and won't allow dots in the name of the macro but hopefully you get the gist.) -- Alastair
participants (3)
-
Alastair Reid
-
Ross Paterson
-
Simon Marlow