J�rgen Hermanrud Fjeld wrote:
The O'Caml language permits recursive data definitions, when the option
-rectypes is given. There was/is just a discussion about this on the
O'Caml mailing list, and there are no theoretical problems with
recursive data definitions, but the type inference engine infers weird
types for cases that otherwise would be discovered as errors,
and then even weirder error messages appear when using the functions.


(* with -rectypes *)
type t = t option

(* without -rectypes *)
type t = Some of t | None

(* Sample session from interactive toplevel for O'Caml *)
#ocamli -rectypes
Objective Caml version 3.08.2

# type t = t option;;
type t = t option
# let (x:t) = None;;
val x : t = None
# let (x:t) = Some (Some x);;
val x : t = Some (Some None)

I don't see what is weird about this, at least from the given example. It works as I would expect from recursive types in Haskell and other languages.

--
David Hopwood <[EMAIL PROTECTED]>



_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to