Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Cyclic ?!
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Markus Mottl <markus@o...>
Subject: Re: [Caml-list] Cyclic ?!
On Thu, 15 Aug 2002, Oleg wrote:
> I'm not sure I understand you. If the two definitions are equivalent WRT 
> Empty <-> None & Node <-> Some name substitution, then the fact that the 
> compiler accepts one, but not the other must be a bug, yes?

This is not a bug, because you can have the compiler typecheck it using
the command-line flag "-rectypes".

You'll certainly want to know now why this isn't standard behaviour.
Type inference of recursive types is actually neither a theoretical
problem nor an implementation difficulty (basically, I think, you just
need to drop the occurs check during type unification - please correct
me if I'm wrong).

The problem rather is that programmers can accidently write down
meaningless expressions for which the compiler infers absolutely crazy
types. If I remember correctly, OCaml already had the more general rule
by default in some ancient version, but the developers found that this
generality caused more confusion than benefits to programmers...

Regards,
Markus Mottl

-- 
Markus Mottl                                             markus@oefai.at
Austrian Research Institute
for Artificial Intelligence                  http://www.oefai.at/~markus
-------------------
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