caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Martin Jambon <martin.jambon@ens-lyon.org>
To: Kaustuv Chaudhuri <kaustuv.chaudhuri@gmail.com>
Cc: caml-list <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Inspect and dump values on the OCaml heap
Date: Wed, 14 Apr 2010 22:42:39 -0700	[thread overview]
Message-ID: <4BC6A74F.7010106@ens-lyon.org> (raw)
In-Reply-To: <n2tf02e7f931004141909rce52bc29i29786b88c8ba8689@mail.gmail.com>

Kaustuv Chaudhuri wrote:
> On Wed, Apr 14, 2010 at 5:02 PM, Kaspar Rohrer <kaspar.rohrer@gmail.com> wrote:
>> [...]
> 
> Implementing dumpers seems like a teething procedure for
> OCaml hackers. Here's my own attempt from a couple of years ago.
> It handles cycles, renders SVGs (via Graphviz), and can accept
> data structure "descriptions" to produce better names for the
> internal nodes. It is almost 100% OCaml.
> 
>   http://www.lix.polytechnique.fr/~kaustuv/misc/ocaml_show.html
> 
> I am convinced that such things have *no* usefulness. If you
> are trying to debug your data structure, state its global
> invariants, prove (at whatever level of formality you are most
> comfortable with) that all API functions preserve the invariants,
> and use the module system to hide functions that do not
> preserve them. You will be done faster than trying to make
> sense of graphs and your code will be better.

The only reason why I wrote Dum was to print exceptions deeper than
Printexc.to_string:

# exception Foo of [`Bar of string];;
exception Foo of [ `Bar of string ]

# Printexc.to_string (Foo (`Bar "abc"));;
- : string = "Foo(_)"

# Dum.to_string (Foo (`Bar "abc"));;
- : string = "((\"Foo\") (3303859 \"abc\"))"


Martin

-- 
http://mjambon.com/


      parent reply	other threads:[~2010-04-15  5:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-14 15:02 Kaspar Rohrer
2010-04-14 22:45 ` [Caml-list] " Richard Jones
2010-04-14 23:23   ` Kaspar Rohrer
2010-04-15  0:40     ` Martin Jambon
2010-04-15  5:19     ` rixed
2010-04-15  2:09 ` Kaustuv Chaudhuri
2010-04-15  5:31   ` rixed
2010-04-15  5:42   ` Martin Jambon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BC6A74F.7010106@ens-lyon.org \
    --to=martin.jambon@ens-lyon.org \
    --cc=caml-list@yquem.inria.fr \
    --cc=kaustuv.chaudhuri@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).