On Sunday, December 16, 2001, at 03:14  AM, John Hughes wrote:

> The way a filename is interpreted in an import, such as
> �
> ��� import "src/M"
> �
> has changed under the December 2001 version of hugs. 
> Previously, the filename was interpreted relative to the 
> location of the importing module. That seems no longer to be 
> the case (although I'm not sure where hugs does look nowadays).
> �
> As a result, it's now impossible to load Fran, which places a 
> few "public" modules in the directory you add to your path, and 
> then loads many more from the src subdirectory. The idea is to 
> avoid cluttering the module name space with all the internal 
> modules.
> �
> Is this a deliberate change? I didn't find any information on 
> it in the notes on the new release, so I assume it's a bug.
>

Hugs now support the hierarchical module namespace extension, 
pretty much as it is described in Malcolm Wallace's proposal 
(http://www.cs.york.ac.uk/fp/libraries/).  Hugs also allows file 
names in import clauses as another extension, but to in order to 
simplify the already complex mapping of import declarations to 
files, Hugs no longer performs any advanced searching in the 
latter case.

The hope is of course that programmers will start using the new 
feature.  In the case of Fran that would mean renaming the src 
directory Src, changing "src/M" in an import list to Src.M, and 
finally change the name for every module M in Src to Src.M.

The current file mapping algorithm can be described by the 
following Haskell program, where the result represents the order 
in which files are examined, and where "along" stands for the 
location of the importing module.

   find along nm hugspath
     | isModuleId nm = [ d++f++e | f <- files, d <- dirs, e <- exts ]
     | otherwise     = [ nm ++ e | e <- "" : exts ]
     where
       dirs          = along : "" : hugspath
       files         = [mod2dir nm, nm]
       exts          = [".hs",".lhs"]

       isModuleId s  = all isConid (splitAt '.' s)
       mod2dir s     = map (\c -> if c=='.' then slash else c) s

All the best,
Johan


_______________________________________________
Hugs-Bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/hugs-bugs

Reply via email to