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
[Caml-list] local root registration
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-02-24 (17:28)
From: Xavier Leroy <xavier.leroy@i...>
Subject: Re: [Caml-list] local root registration
> > We've been through several designs for the "local root registration" API.
> > The CAMLxxx macros are the latest design, and the one that we think is
> > the easiest to use.
> I agree that they are easiest if one strictly follows the rules in the
> documentation. However, I would like to point out that there are cases where
> one does not want to do this. In these cases, the older macros (Begin_roots
> and End_roots) are much more flexible, and can even lead to better code.

I agree there are cases where root registration is required only on
rarely-executed paths, and in this case Begin_roots/End_roots allow
avoiding the cost of root registration on other paths.  I haven't
measured how much speed is gained this way.  Probably not much, since
GC root registration is relatively simple.

> I will discuss this a little. Perhaps the Begin_roots/End_roots macros
> should not be deprecated, but left as a low level alternative?

Begin_roots/End_roots will remain defined for a long time, if only
because I still have some old code that use these macros, and (as
regulars on this list know) I don't like gratuitous breaking of old

The only problem with documenting them as a low-level alternative to
CAMLparam is that the chapter "Interfacing Caml with C" of the
documentation is already huge and quite hard to read!  Perhaps a
different organization of this chapter (e.g. a separate chapter for
"Advanced topics in interfacing Caml with C") is in order.

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