[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Jacques Garrigue <garrigue@m...> |
| Subject: | Re: [Caml-list] generalization and let module |
From: Julien SIGNOLES <julien.signoles@cea.fr> > Just a single question: why is 'f' not generalizable in the following > example? I'm not able to find an example using any "let module" and > breaking the type safety. > > ===== > module M = struct end > let f = let module N = M in fun x -> x > ===== What about let f = let module M = struct let x = ref [] end in fun x -> let y = List.hd !M.x in M.x := [x]; y ;; Making this function polymorphic would clearly be unsound. However, you're right on one account: this can only happen with structures, but not with module aliasing, or even functor application. So the non-expansiveness check could be refined. Jacques Garrigue