Version française
Home     About     Download     Resources     Contact us    
Browse thread
Module naming
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Andreas Rossberg <rossberg@p...>
Subject: Re: Module naming
Max Skaller wrote:
> 
> I'm confused: why doesn't this work? [I get unbound type ctor message]
> [shortened version]
> 
> module type X = sig type one end
> module type Y = sig type two end
> module type XY = sig module type XX = X module type YY = Y end
> module type Client = functor (T: XY) ->
>   sig val f: T.XX.one -> unit end
>              ^^^^^^^^
> 
> What I expected was that T.XX.one would refer to the
> type X.one, but this doesn't seem to be the case.

You cannot even say

	type one = X.one

What you tried is just a more complicated example of the same thing.
Signature members cannot be accessed via the dot notation - it would not
make any sense. You cannot refer to X.one just as you cannot write

	module type X = sig val one: int end
	let one = X.one

Signatures just contain descriptions of entities - values, types,
modules, etc. - they do not contain the actual things. So there simply
is no type "X.one" if X is a signature, the notation does not even
exist. If you want to access an actual entity you need a structure that
matches the signature X.

I'm not sure what you were trying to do, maybe you meant to say

> module type XY = sig module XX : X module YY : Y end

? With this your example should be perfectly valid.

Hope this helps,

	- Andreas

-- 
Andreas Rossberg, rossberg@ps.uni-sb.de

:: be declarative. be functional. just be. ::