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: Brian Smith <brian-l-smith@u...>
Subject: Re: [Caml-list] Cyclic ?!
Hi,

Markus Mottl wrote:
> 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".
> 
> 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...

But, if this is the case, then wouldn't that still apply to other parts 
of a program using recursive types? In other words, if I use one 
recursive type, then I must use -rectypes, but that means that the 
"extra strict checking" that O'Caml normally does won't help me in the 
rest of my program, where I might use recursive types accidently and 
thus cause O'Caml to infer "absolutely crazy types".

I think, instead of a command-line option, it would be better to provide 
a syntactical annotation on each type definition where this behavior is 
desired. That way, the default strict checking would always apply, but 
it can be overridden by somebody that knows they really really want a 
recursive type.

What do you think?

- Brian



-------------------
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