English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2007-03-21 (12:47)
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

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