English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2004-12-16 (22:38)
From: John Prevost <j.prevost@g...>
Subject: Re: [Caml-list] Dummy polymorphic constructors
On Thu, 16 Dec 2004 20:22:57 +0100, Alex Baretta <alex@barettadeit.com> wrote:
> Currently ocaml does not support empty polymorphic variant sum types.
> Say, I cannot write the following.
> type empty = [ ]
> This fails due to a syntax error rather than a typing error, which is a
> sensible, given that the type expression I have written is actually
> perfectly meaningful.

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

type empty

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