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-22 (14:45)
From: John Carr <jfc@m...>
Subject: Re: [Caml-list] Polymorphism and the "for" loop

>   # type void = Constr of void;;
>   type void = Constr of void

Given this definition a void value can be constructed as
let rec x = Constr x;;
or a pair of void values as
let rec x = Constr y and y = Constr x;;

In response to another message, ocamlopt does not eliminate unit
arguments to functions though it does avoid construction of unused
unit values within functions[*].  In the machine code for
let g (f : unit -> int) = f ()
the machine value 1 (representing ()) is passed to function f.

*See asmcomp/ function remove_unit.

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