self-import
Simon Peyton-Jones
simonpj at microsoft.com
Wed Jan 19 06:59:42 EST 2005
Good point, thank you! I'd forgotten that the OGI modules paper, which I
read carefully at the time, covered recursion (Section 5.4).
But my real point wasn't that it's impossible to define a meaning, only
that the meaning might be a bit unexpected to a programmer, and involves
a fixpoint calculation (which the paper indeed performs). It does also
require the scope-resolver to process the whole of a strongly-connnected
component of modules at a time, which GHC isn't set up to do. That's an
engineering issue, not a semantic one, though.
Simon
| -----Original Message-----
| From: Thomas Hallgren [mailto:hallgren at cse.ogi.edu]
| Sent: 18 January 2005 22:12
| To: Simon Peyton-Jones; glasgow-haskell-users at haskell.org
| Cc: john at repetae.net
| Subject: Re: self-import
|
| Simon Peyton-Jones wrote:
|
| >I quite liked this idea until I thought of this:
| >
| > module Doc.Pretty.Long( M.f, f ) where
| > import qualified M( f )
| > import Doc.Pretty.Long as M
| >
| > f x = x
| >
| >The second import decl imports all the things exported by
| >Doc.Pretty.Long. But what does it export? Well, M.f. But what is
M.f.
| >Well, it could be the f coming from 'import M.f'. But wait!
| >Doc.Pretty.Long exports the locally-defined f too... and the second
| >import decl will make that be called M.f too.
| >
| >
| Our module system paper has answers to this type of questions, since
it
| deals with the meaning of recursive modules:
|
| http://www.cse.ogi.edu/~diatchki/hsmod/
|
| It is implemented in the Programatica Haskell front-end, which thus
| supports modules importing themselves in particular, and mutually
| recursive modules in general, without the need for boot .hi files. I
| wonder when other Haskell implementations are going to catch up? :-)
|
| --
| Thomas H
More information about the Glasgow-haskell-users
mailing list