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
Print values like the toplevel's printer
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-11-06 (11:24)
From: Jim <jim@f...>
Subject: Re: [Caml-list] Print values like the toplevel's printer
On Fri, Nov 05, 2004 at 01:23:13PM +0100, Wolfgang Müller wrote:

> I would like to print values to a file in a human-readable manner without 
> having to compose the output writers of print_int and friends. In short, I 
> would like to use the toplevel's function for screen output of structured 
> values.
> Is there a simple way, a FM or a mailing list you can point me to?
> I googled quite a bit, but apparently not with the right terms.

Aside from clever uses of various bits of the top level, you can also
use camlp4 to automatically generate print functions for types.  I think
there is an example in the camlp4 manual.

What we really need is generics.  I thought there was a post in the
mailing list some time ago saying that generics was going to be
appear in O'Caml at some point, but I haven't seen anything for a long
time.  Does anyone know if it is still planned?