Problem with hierarchical libraries.

Iavor S. Diatchki diatchki@cse.ogi.edu
Fri, 07 Mar 2003 13:38:25 -0800


hello,

Olaf Chitil wrote:
>...

> I know that we generally try to avoid specifying filename and directory
> issues. 
> However, this is not really a filename issue, but a problem of relative
> and absolute module names (wrt possibly several hierarchies). An "import
> B" in module Test.A could mean either module B or module Test.B. 
> I suggest that the absolute module name takes precedence, because
> otherwise there is no way to import module B from module Test.A, whereas
> you can always import module Test.B from module Test.A by saying "import
> Test.B".

why not fix the design to take this into account?  one can have two ways 
to refer to modules - relative and absolute (just like in the file 
system, which years of experience show works pretty well).

import .Test.A  -- refers to an absolute path
                 -- (relative to a user specified root)
                 -- i.e. $HS_PATH/Test/A.hs
import Test.A	-- is a path relative to the location of
		-- the current module, i.e.
		-- [location of module]/Test/A.hs

in fact it seems that a nice way to implement separate compilation
in a concrete implementation could be to have 2 top level paths:
$HS_LIBS $HS_PROJ
the implementation should look for absoulte files relative to both of 
those, but it would expect that if something is found in the $HS_LIBS 
path it will be already compiled and not look for source code.  just an 
idea.

i also have another question about the hirarchical modules design -- why 
does one have to duplicate the path to a particular file inside the file 
itself?   i.e. what is the point of the module name within the file?
it seems that all haskell implementations assume that the module name 
and file name are the same (and this seems perfectly reasonable), and 
with the hirarchical name space this is even more the case.  and for 
example C programers never specify the name of the current file within 
the file.  why do we want to do it?

just wondering
iavor


-- 
==================================================
| Iavor S. Diatchki, Ph.D. student               |
| Department of Computer Science and Engineering |
| School of OGI at OHSU                          |
| http://www.cse.ogi.edu/~diatchki               |
==================================================