From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 323907EEBF for ; Wed, 19 Aug 2015 01:32:18 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of dra-news@metastack.com) identity=pra; client-ip=62.13.148.114; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="dra-news@metastack.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of dra-news@metastack.com designates 62.13.148.114 as permitted sender) identity=mailfrom; client-ip=62.13.148.114; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="dra-news@metastack.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@outmail148114.authsmtp.net) identity=helo; client-ip=62.13.148.114; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="dra-news@metastack.com"; x-sender="postmaster@outmail148114.authsmtp.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AEAQCKv9NVnHKUDT5dgm+BaaonBptTAoE7TAEBAQEBARIBAQEBAQYNCQkhLoQjAQEBAwEDNz8FCwIBCBgeEDIlAgQOBYgmCQPRdQEBAQEBBQEBAQEBAQEBAQEBF4YghTOEVzMHgxiBFAWMYIhCjjaUfoNngmWBPnGCTAEBAQ X-IPAS-Result: A0AEAQCKv9NVnHKUDT5dgm+BaaonBptTAoE7TAEBAQEBARIBAQEBAQYNCQkhLoQjAQEBAwEDNz8FCwIBCBgeEDIlAgQOBYgmCQPRdQEBAQEBBQEBAQEBAQEBAQEBF4YghTOEVzMHgxiBFAWMYIhCjjaUfoNngmWBPnGCTAEBAQ X-IronPort-AV: E=Sophos;i="5.15,705,1432591200"; d="scan'208";a="174012912" Received: from outmail148114.authsmtp.net ([62.13.148.114]) by mail2-smtp-roc.national.inria.fr with ESMTP; 19 Aug 2015 01:32:17 +0200 Received: from mail-c235.authsmtp.com (mail-c235.authsmtp.com [62.13.128.235]) by punt16.authsmtp.com (8.14.2/8.14.2/) with ESMTP id t7INW9Pr090478; Wed, 19 Aug 2015 00:32:09 +0100 (BST) Received: from romulus.metastack.com (114.212-105-213.static.virginmediabusiness.co.uk [213.105.212.114]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/) with ESMTP id t7INW8LM078409; Wed, 19 Aug 2015 00:32:09 +0100 (BST) Received: from remus.metastack.local (remus.metastack.com [172.16.0.1]) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id t7INW7pq027372 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Wed, 19 Aug 2015 00:32:08 +0100 Received: from Remus.metastack.local ([fe80::547c:3c42:e1da:eda2]) by Remus.metastack.local ([fe80::547c:3c42:e1da:eda2%10]) with mapi id 14.03.0248.002; Wed, 19 Aug 2015 00:32:07 +0100 From: David Allsopp To: Oliver Bandel CC: "caml-list@inria.fr" Thread-Topic: [Caml-list] Simple exception - different behaviour between toplevel and compiled Thread-Index: AQHQ2gb/9vuHcUynMUyfcztAVG4zw54SaCJt Date: Tue, 18 Aug 2015 23:32:06 +0000 Message-ID: <00A7715E-A042-4847-89F4-BA6F8AF20662@metastack.com> References: <20150819004103.Horde.gmnxtcrVOwNtWht0UpT4DzE@webmail.in-berlin.de> In-Reply-To: <20150819004103.Horde.gmnxtcrVOwNtWht0UpT4DzE@webmail.in-berlin.de> Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Organization: MetaStack Solutions Ltd. X-Scanned-By: MIMEDefang 2.65 on 172.16.0.20 X-Server-Quench: 5834fbf6-4601-11e5-b398-002590a15da7 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCd1ZAARAlZZVg1f DC4bFwdFRBksPQFF ChxFJgxfNl8UURhQ KkJXbgASJgRNAnhE VHkJW1VRQF1xU2B3 YQpYIwdcYVRPXwB0 UklLXFNTEBpqBAMB SFoZK2cVf3k7eHl4 YUZrEHdbWEQ0cE5+ RhgGQ2sbYWFgaX0e URVdalFXeQtXfh9H b1l/BXIINTQAKBg1 TUcAFDk0OXBbKT9J d0k2LFcKRUtDEy43 SggeHDIpVQhNSyQ9 IRE8J1gAVEwcMkws MFw8QxoSPgMNBwBY fQlRBzddKkcMQ2Ii Cw8SVkkbCDxZTCs0 X-Authentic-SMTP: 61633634383431.1023:706 X-AuthFastPath: 0 (Was 255) X-AuthSMTP-Origin: 213.105.212.114/25 X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. Subject: Re: [Caml-list] Simple exception - different behaviour between toplevel and compiled > On 19 Aug 2015, at 00:41, Oliver Bandel wrote: >=20 > Hello, >=20 >=20 > using the attached files (executing testexc,bash) > I got different results between toplevel and compiled: >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > Testcase A > exception A of int * int > let _ =3D raise ( A(3,4) ) > Exception: A (3, 4). > Fatal error: exception Exca.A(3, 4) > Fatal error: exception Exca.A(3, 4) > Testcase B > exception B of (int*int) > let _ =3D raise ( B(3,4) ) > Exception: B (3, 4). > Fatal error: exception Excb.B(_) > Fatal error: exception Excb.B(_) > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >=20 > So just adding parantheses in a definition of an exception > yields in these differing results, with not-shown exception-values. >=20 > IMHO looks like a case for the bugtracker... There's no requirement for the toplevel and the compilers to behave the sam= e way for reporting the exception. The output, for example, also differs in= the way the exception message is formatted, there's no 'Fatal error:' and = so on - do you want that to be a bug too? The toplevel has access to typing information which is not available to oca= mlc/ocamlopt (the runtime only knows the name of the exception - beyond tha= t, it's just presented with a standard variant block). I haven't got a comp= iler to hand, but I think you'll also see differences if you use a variant = instead of numbers (ocaml will display the constructor name, the compilers = will display its constructor number) and I think you'll also see the same o= utput as the compilers if you compile excb.cmo and then #load it in the top= level. It's not normal to want to terminate your compiled program with an uncaught= exception, hence the simpler default exception printer in compiled code. I= f you really want the exception printed accurately, you can register a prin= ter (see Printexc.register_printer). David