Version française
Home     About     Download     Resources     Contact us    
Browse thread
Why isn't -rectypes command line option the default
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Gerd Stolpmann <info@g...>
Subject: Re: [Caml-list] Re: Why isn't -rectypes command line option the default
Am Mittwoch, den 21.03.2007, 13:13 +1100 schrieb Erik de Castro Lopo:
> Zheng Li wrote:
> 
> > So the main consideration is safety, though it's really fun to play with
> > recursive types sometimes.
> 
> Ok, I can see why they aren't on by default, but using -rectypes on 
> the whole file exposes to the whole file to these errors.
> 
> Wouldn't it be nicer to be able to specify the rectypes behaviour
> per type? Maybe something like this would work:
> 
> 	rec type 'a t = 'a * 'a t Lazy.t

You can do that:

type 'a t = T of 'a * 'a t Lazy.t

Recursive types are accepted without -rectypes when the recursion
crosses a variant type. Note that the runtime costs are usually
negligible.

Gerd
-- 
------------------------------------------------------------
Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany 
gerd@gerd-stolpmann.de          http://www.gerd-stolpmann.de
Phone: +49-6151-153855                  Fax: +49-6151-997714
------------------------------------------------------------