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
Void type?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-08-01 (16:23)
From: Markus Mottl <markus.mottl@g...>
Subject: Re: [Caml-list] Re: Void type?
On 8/1/07, Tom <tom.primozic@gmail.com> wrote:
> I am still not convinced about the usability of the void type... Why simply
> not declare type b as abstract?
> module Myreq = struct
>         type a = whatever
>         type b
> end
> Essentially, it means the same, just less typing.

Less typing in the type definition, but more typing handling a
function or match branch that makes use of a value of type b.  You'd
either have to raise an exception there, or do something unsafe.  The
"void"-solution is much cleaner.


Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com