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
partial application warning unreliable?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-12-09 (12:21)
From: Andreas Rossberg <rossberg@p...>
Subject: Re: [Caml-list] partial application warning unreliable?
skaller wrote:
> The correct type is void, however unit
> will catch more errors than 'a.

IIRC, this has been discussed in the past, but since you iterate this 
statement repeatedly, let me reinforce that it is incorrect.

Void is the empty type. No value of this type can be constructed. Since 
in ML, everything is an expression, and every "procedure" a function, 
they all have to evaluate to something. Hence, the only possible 
functions with result type void are those that do not return. The only 
possible functions with argument type void are those that can never be 

The type unit on the other hand, is the trivial type. It carries just 
one value, and hence no information. Consequently, it is the canonical 
type to use for functions that do not require or do not return any 

Type theory wasn't well developed in the 60s, when Algol 68 (I think) 
introduced its notion of void type that was later inherited, in even 
more abusive ways, by C and friends. The name is just historical 
accident, it really ought to be unit.

   - Andreas

Andreas Rossberg, rossberg@ps.uni-sb.de

Let's get rid of those possible thingies!  -- TB