From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 6B96BBC57 for ; Thu, 15 Apr 2010 04:09:05 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AowCAOkRxkvRVaC0mGdsb2JhbACDFI4wig8IFQEBAQEBCAkMBxEirRQ3gXCGES6ITQEBAwWBJ4JzbgQ X-IronPort-AV: E=Sophos;i="4.52,209,1270418400"; d="scan'208";a="48505381" Received: from mail-gy0-f180.google.com ([209.85.160.180]) by mail3-smtp-sop.national.inria.fr with ESMTP; 15 Apr 2010 04:09:04 +0200 Received: by gyb13 with SMTP id 13so410882gyb.39 for ; Wed, 14 Apr 2010 19:09:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:content-type; bh=Ncs6SRVFabuDCSZV2ynx21WzLx3JnRi5DhHI1acO6Tk=; b=EKxWxr9psoDN8ms7Jb2shU7s4ot3jebsWtpFyHTURAPZALMlrbcW0JmL4TnF/UCLWm 6kcmh3e2lyP63Y/qXtjQlel4ErqJsv2hc2MzoQvPLda1aTYTfc+wObDMKsGpvnMd/xXD 36JnuiGHxaNnnve2Sst2/Ty8sAwDUAJ2tlxxI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=fzpmd19cR/i4kZ4BYQnuKiMnOzGkt5bfU8Zr5TitylqjaB3gv05JGC5rroLQ/oPLL/ m8+7W4AEQYJXgop9RZ9vXqSr8CuNnqpHIN3UVONjYSboCFTWiJ2yxQPTCI7XOuI8XxUP j/8yHG7r11KsAPj40Hi5N8tBgipYUyuNmxKY8= MIME-Version: 1.0 Received: by 10.90.105.10 with HTTP; Wed, 14 Apr 2010 19:09:02 -0700 (PDT) In-Reply-To: <3FB04EDC-37F4-4336-A435-13ACF038051D@gmail.com> References: <3FB04EDC-37F4-4336-A435-13ACF038051D@gmail.com> Date: Thu, 15 Apr 2010 04:09:02 +0200 Received: by 10.90.236.8 with SMTP id j8mr3821315agh.5.1271297342470; Wed, 14 Apr 2010 19:09:02 -0700 (PDT) Message-ID: Subject: Re: [Caml-list] Inspect and dump values on the OCaml heap From: Kaustuv Chaudhuri To: caml-list Content-Type: text/plain; charset=UTF-8 X-Spam: no; 0.00; ocaml:01 ocaml:01 renders:01 graphviz:01 nodes:01 lix:01 invariants:01 invariants:01 wrote:01 heap:01 caml-list:01 functions:01 functions:01 data:02 data:02 On Wed, Apr 14, 2010 at 5:02 PM, Kaspar Rohrer 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. -- Kaustuv