Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Virgile Prevosto <virgile.prevosto@m4x.org>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Printexc cannot print some (but not all) exceptions
Date: Fri, 13 Jan 2006 18:23:10 +0100	[thread overview]
Message-ID: <20060113182310.60349897@localhost.localdomain> (raw)
In-Reply-To: <20060113163627.GB14618@furbychan.cocan.org>

Le ven 13 jan 2006 16:36:29 CET, Richard Jones a écrit:
> exception Http_error of (int * string);;
>   (* The server sent an error message. The left component of the pair is
>    * the error code, the right component is the error text.
>    *)
> 
> I'll resort to using Std.dump to find out what's in the exception,
> although it would be nice if Printexc could look inside the tuple and
> print its contents.
> 

The main issue is that Printexc has no way to know that it is a tuple and
not the value of a sum type whose first non-constant constructor takes
two arguments. For Std.dump, such a value is a tuple, but it could also
have identified it with a list:

#require "extlib";;
/home/prevosto/softs/godi/lib/ocaml/pkg-lib/extlib: added to search path
#load "extlib.cma";;
# exception Wrong of (int * int);;
exception Wrong of (int * int)
#  Std.dump (Wrong (1,0));;
- : string = "[(\"Wrong\"); 1]"

I think that for a function of the standard library it is safer to make
a more conservative choice.

-- 
E tutto per oggi, a la prossima volta
Virgile


      reply	other threads:[~2006-01-13 17:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-13 15:23 Richard Jones
2006-01-13 15:54 ` [Caml-list] " Virgile Prevosto
2006-01-13 16:36   ` Richard Jones
2006-01-13 17:23     ` Virgile Prevosto [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=20060113182310.60349897@localhost.localdomain \
    --to=virgile.prevosto@m4x.org \
    --cc=caml-list@yquem.inria.fr \
    /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