Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
RE: [Caml-list] Polymorphism and the "for" loop
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-10-23 (20:58)
From: Christophe Raffalli <christophe.raffalli@u...>
Subject: Re: [Caml-list] Polymorphism and the "for" loop

I think the main difference with unit and a type "void" meaning 
returning nothing, is that void should not be allowed on the left side 
of an arrow.

Then, you could have two types:

unit (for function taking no argument), but unit should be illegal on 
the right side of an arrow (in type)

void (for function returning nothing), but void should be illegal on the 
left side of an arrow.

Then it would be impossible to compose a function returning void with 
another function (on the left) or a function waiting for unit with 
another function (on the right)

To impement this in the type system, you need to mark polymorphic 
variable to know if they can be instanciated with void or/and unit we 
would have

'a _a '_a '_a ... polymorphic variables may be a bit too much :-)

Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
IMPORTANT: this mail is signed using PGP/MIME
At least Enigmail/Mozilla, mutt or evolution
can check this signature. The public key is
stored on