caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* A signature that cannot be inhabited by any structures
@ 2007-09-08  7:54 Hyeonseung Im
  2007-09-08 11:39 ` [Caml-list] " Vincent Aravantinos
  0 siblings, 1 reply; 2+ messages in thread
From: Hyeonseung Im @ 2007-09-08  7:54 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 47 bytes --]

?)7/ :N:P@87N 18<:5H MIME G|=D@G 8^=CAv@T4O4Y.

[-- Attachment #2: Type: text/plain, Size: 627 bytes --]

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.

 


[-- Attachment #3: Type: text/html, Size: 3334 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] A signature that cannot be inhabited by any structures
  2007-09-08  7:54 A signature that cannot be inhabited by any structures Hyeonseung Im
@ 2007-09-08 11:39 ` Vincent Aravantinos
  0 siblings, 0 replies; 2+ messages in thread
From: Vincent Aravantinos @ 2007-09-08 11:39 UTC (permalink / raw)
  To: Hyeonseung Im; +Cc: caml-list


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-09-08 11:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-08  7:54 A signature that cannot be inhabited by any structures Hyeonseung Im
2007-09-08 11:39 ` [Caml-list] " Vincent Aravantinos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).