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
[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: -- (:)
From: Jon Harrop <jon@j...>
Subject: Re: [Caml-list] Polymorphism and the "for" loop
On Friday 22 October 2004 07:19, skaller wrote:
> ...I consider that a bug...

I'd have to go right ahead and disagree with you there. Surely a "procedure" 
returns no information, which can be achieved by returning the only value 
from a type representing a singleton set, i.e. _the_ value of the type unit.

>  type void = []

Why not "`void"?

I've been wondering about this recently: how do the compilers store types 
which contain "unit". For example, if we have a tree:

type 'a 'b tree = Leaf of 'a | Node of 'b * 'a 'b tree * 'a 'b tree

Does a "unit unit tree" take up less space than a "int int tree"?

The reason I'm asking is that it might be nice to generalise data structures 
as much as possible and then specialise them using "unit" arguments.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: