Version française
Home     About     Download     Resources     Contact us    
Browse thread
A confusing module question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Keiko Nakata <keiko@k...>
Subject: Re: [Caml-list] A confusing module question

From: "Yaron Minsky" <yminsky@gmail.com>

> Here's some fairly simple module code that fails unexpectedly.  N compiles
> cleanly, but M has an error, even though they seem like they should both
> work:
> 
> module type S = sig type t end
> 
> module M :
> sig
>   type exposed_t = { foo : int }
>   include S with type t = exposed_t
> end =
> struct
>   type t = { foo : int }
>   type exposed_t = t
> end
> 
> module N :
> sig
>   type exposed_t = { foo : int }
>   include S with type t = exposed_t
> end =
> struct
>   type exposed_t = { foo : int }
>   type t = exposed_t
> end

I agree with you. 
I understand why N fails according to the language specification,
but I still do not understand why it should fail, or what is useful 
about this behavior when programming with.

Best,
Keiko