Version française
Home     About     Download     Resources     Contact us    
Browse thread
Dummy polymorphic constructors
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alex Baretta <alex@b...>
Subject: Re: [Caml-list] Dummy polymorphic constructors
John Prevost wrote:
>>type empty = [ ]

> 
> I'm somewhat confused as to why this is different from simply
> declaring a new opaque type:
> 
> type empty

Ah, this is interesting!

> Since there is no way to construct a value of the type, nor any way to
> deconstruct such a value, how is it different?
> 
> John.
> 

Not much, actually. I thought opaque types could only be *declared*.

module M : sig type t end = struct type t = *** end

I never realized that a type could be *defined* as opaque.

module M = struct type t end

Alex

-- 
*********************************************************************
http://www.barettadeit.com/
Baretta DE&IT
A division of Baretta SRL

tel. +39 02 370 111 55
fax. +39 02 370 111 54

Our technology:

The Application System/Xcaml (AS/Xcaml)
<http://www.asxcaml.org/>

The FreerP Project
<http://www.freerp.org/>