[Ur] introducing a name in functor body

Adam Chlipala adamc at impredicative.com
Thu Dec 1 09:12:14 EST 2011


Gergely Buday wrote:
> functor Main(M: sig end ) : sig val foo : int  end =
> struct
>    open M
>
>    con Field :: Name
>
>    val foo = 3
> end
>
> What is wrong with this?
>    

The problem is the same as if you had merely written [val foo : int] 
instead of [val foo = 3]: you are writing an _interface_ declaration 
(i.e., "signature item") in a position that expects an _implementation_ 
declaration (just called "declaration" in the manual).  There is no 
declaration for generating a fresh name automatically; you would 
probably take that name into the functor as an input.



More information about the Ur mailing list