Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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/cmmgen.ml function remove_unit.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners