Browse thread
A signature that cannot be inhabited by any structures
-
Hyeonseung Im
- Vincent Aravantinos
[
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: | 2007-09-08 (11:39) |
From: | Vincent Aravantinos <vincent.aravantinos@y...> |
Subject: | Re: [Caml-list] A signature that cannot be inhabited by any structures |
Le 8 sept. 07 à 09:54, Hyeonseung Im a écrit : > Hi all. > > > > I found something interesting. In the OCaml, the following > signature is valid. (I tested it with the OCaml version 3.09.2 and > 3.10.0.) > > > > (In the top-level) > > # module type S = sig val x : int val x : float end;; > > module type S = sig val x : int val x : float end > > > > But, this module type seems not to be inhabited by any structures. > On the contrary, in the SML this sort of module types cannot be > defined. (Actually, it raises an error: the duplication of variables.) > > > > I wonder if this is a feature of the OCaml (or maybe a bug in the > implementation). > > I’d appreciate any comment on it. > > > > Hyeonseung Im. > Hi, apart from the question "is this a bug or a feature ?", I'd like to say this is quite useful when you want to do some kind of inheritance between modules. See http://caml.inria.fr/pub/ml-archives/caml-list/ 2007/08/8f1e17b89b64d66ae406521947709aff.en.html for the different situation for type replication. Vincent