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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id F03FC7EE9C for ; Tue, 29 Nov 2016 11:21:24 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=ilitzroth@gmail.com; spf=Pass smtp.mailfrom=ilitzroth@gmail.com; spf=None smtp.helo=postmaster@mail-io0-f180.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of ilitzroth@gmail.com) identity=pra; client-ip=209.85.223.180; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="ilitzroth@gmail.com"; x-sender="ilitzroth@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of ilitzroth@gmail.com designates 209.85.223.180 as permitted sender) identity=mailfrom; client-ip=209.85.223.180; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="ilitzroth@gmail.com"; x-sender="ilitzroth@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-io0-f180.google.com) identity=helo; client-ip=209.85.223.180; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="ilitzroth@gmail.com"; x-sender="postmaster@mail-io0-f180.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AP/hQFxFGLCqpaxiYhWIbFZ1GYnF86YWxBRYc798d?= =?us-ascii?q?s5kLTJ7yp8+wAkXT6L1XgUPTWs2DsrQf2rGQ6P+rADBYqb+681k6OKRWUBEEjc?= =?us-ascii?q?hE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRo?= =?us-ascii?q?LerpBIHSk9631+ev8JHPfglEnjSwbLd8IRmsowjctMYajZZtJ6ot1xDEvmZGd+?= =?us-ascii?q?NKyG1yOFmdhQz85sC+/J5i9yRfpfcs/NNeXKv5Yqo1U6VWACwpPG4p6sLrswLD?= =?us-ascii?q?TRaU6XsHTmoWiBtIDBPb4xz8Q5z8rzH1tut52CmdIM32UbU5Uims4qt3VBPljj?= =?us-ascii?q?oMOiUn+2/LlMN/kKNboAqgpxNhxY7UfJqVP+d6cq/EYN8WWXZNUsNXWiNGH428?= =?us-ascii?q?cpAPD/IfMulEs4nzqVwOrR6kCgmtAuPk1ztEi3Dy0KE/1ekqDAPI0xE6H98Wsn?= =?us-ascii?q?vUotX7OqkRX+6o0qfH0S7OYOlK1Trn8oXEbgwtrPOKULltccTR004vFwbdg1WR?= =?us-ascii?q?rIzlOima1uIQs2eF6+prSOavi287qwBwuDivwdssionUjY8Sy1DE8SR5wJo0JN?= =?us-ascii?q?2iT057fd6kHYBftyGfLYR2Q8ciT3t0tyY9z70LoJi2dzUExpQgwh7Qcf2Hc46Q?= =?us-ascii?q?7xLiUuaROzZ4i2h/dLKxnRa+6UegyuzgVsm0zVZFtTBJncXLtnAIzxDS6tKISv?= =?us-ascii?q?t6/kemwzqAywfT6uRCLEsplqTbM4YszqAsmpcXq0jOHS/7lF/ogKOIeEgo4PWk?= =?us-ascii?q?5uf7brjgu5SSLZV7ihvkPaQrgsG/Afo3MgwJX2WD/OSzzrzj/UngTLVLif06jr?= =?us-ascii?q?DVsJ7HKckYuqK1GQBV0oEk6xawCzepzs4UkmUALFJAYB6Hjo7pNE/SIP3gE/uz?= =?us-ascii?q?n1ChnC1oyv3GJLHtHIvBI3bZnLv8frtx91ZQyA8pwtBe45JUBKsBIPX2WkLptd?= =?us-ascii?q?zYCh45MxC1wub9D9V9yoMeVHmAAq+cKqzSsFuI6vgzLOmLYY8ZoCz9JOQ95/7y?= =?us-ascii?q?kX85nkcQcrWz0psSbHC0B/BmI0SCYXrwmdoBCmcLvg8mTOPwklGCUDhTZ2yzX6?= =?us-ascii?q?0m/D07BpimXs//QdWCibab3Sq/VqZdZm1cB0rERXjhfZ+FVvNKcymSL9VsiBQL?= =?us-ascii?q?ULGgT8kq0hT45yHgzL8yL+/R8ysFuJar0Nlp9ffUiRF6oT1wDtiPyWaRT0l7m2?= =?us-ascii?q?oJQ3k926Up8h818UuKzaUt268QLtdU/f4cF1pjOA=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0BQAABLVT1YhrTfVdFDGhwBAQQBAQoBA?= =?us-ascii?q?RcBAQQBAQoBAYJ/DgEBAQEBd3MQB408lx+CN412hEiCBh4BCoV5AoF5Bz8UAQE?= =?us-ascii?q?BAQEBAQEBAQESAQEBCAsLCR0wgjMaghsBAQEDAQECDxEdARsSCwEDAQsGBQQHD?= =?us-ascii?q?Q0dAgIhAQERAQUBChIGExIICIgwAQMPCA4unleBMj8yi1CCBAUBH4MNBYNlChk?= =?us-ascii?q?nAwpUgyMBAQEBAQEEAQEBAQEBAQEXAgYShiyEW4JIQ4Frgh84gl0FhwgMkws1h?= =?us-ascii?q?kiGaINWgkGNcUmIdx+EEoJIEx6BEw8PgWwRgmssIIFpPTQBiAwBAQE?= X-IPAS-Result: =?us-ascii?q?A0BQAABLVT1YhrTfVdFDGhwBAQQBAQoBARcBAQQBAQoBAYJ?= =?us-ascii?q?/DgEBAQEBd3MQB408lx+CN412hEiCBh4BCoV5AoF5Bz8UAQEBAQEBAQEBAQESA?= =?us-ascii?q?QEBCAsLCR0wgjMaghsBAQEDAQECDxEdARsSCwEDAQsGBQQHDQ0dAgIhAQERAQU?= =?us-ascii?q?BChIGExIICIgwAQMPCA4unleBMj8yi1CCBAUBH4MNBYNlChknAwpUgyMBAQEBA?= =?us-ascii?q?QEEAQEBAQEBAQEXAgYShiyEW4JIQ4Frgh84gl0FhwgMkws1hkiGaINWgkGNcUm?= =?us-ascii?q?Idx+EEoJIEx6BEw8PgWwRgmssIIFpPTQBiAwBAQE?= X-IronPort-AV: E=Sophos;i="5.31,568,1473112800"; d="scan'208,217";a="202123249" Received: from mail-io0-f180.google.com ([209.85.223.180]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 29 Nov 2016 11:21:23 +0100 Received: by mail-io0-f180.google.com with SMTP id m5so143336238ioe.3 for ; Tue, 29 Nov 2016 02:21:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=DlZBAkj5EY704M5AhCD6aYJ2KZQIIX1cbIBrmc2tHg0=; b=E1uRLKO95iZJb3BN6xauzaiYWOBpFo630waMXHgSFYVBT5St32/QfTSIchCiS/49I8 GGQMMM7pDNit3Ta/EZeCRvv61p0C9S6CQ4GUf/WwwQ1gUFzd9lDa5HMTqxHBWziVBBga ghbvwH3lQeIi1ziLriG0jwbhOS7NneSy26r2dTu71OwX0vizV3aE9HLcsNd17ohUuw1v ctQPbLj9oxula/WkdnH/kzzximR6zLR6QTxlbczDCVXWXIzqKoL8XADE2UJ9Tz4N7mQu HDalymU87fpi+xeu5mz+Q4MPILZLsgI8d+zjW0lw0Deg7KkuoPtvPYwrAqw+o9GpdtiW p9Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=DlZBAkj5EY704M5AhCD6aYJ2KZQIIX1cbIBrmc2tHg0=; b=E0v2k3lVv+I2Sxa6X0NSAv4YzSATgPFgCp0jDLLEdpoVwMpv9pOZxFX9n7ObFx/VcA 76BjNq0XdF2OUdvx94wNEIohIsiqm0EakxMR31svr+6vTteSrTQInELXEnIvw537eUO/ lUDms3uj6TLiTfhvBXUui8vHnR9mOrT93D5XwW+/rzIG2Ii7KYkpYjG6LVBzAf6+mJyQ 2ZsU35ny0gAKU2x3Yf+J+jUMm+jB3E/beKenVgOvCqwgcVtg3HV6L6i3SzD4aLGSYI71 mYcJE5dR/38v6Qey7UOkXbsfBgrmXv8sbJj6XqP5fvv6sFwifkCtLMiXOYQMb19isBvN sDRQ== X-Gm-Message-State: AKaTC03Gwne/kjvExmpIL2+nhlrUsyn77whgbWRCQsb9G6WX/Ca7Pxf2TkD/Dgg7qPjRKtJ9Anvcykq8kX3ykA== X-Received: by 10.36.250.201 with SMTP id v192mr22986540ith.106.1480414882613; Tue, 29 Nov 2016 02:21:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.184.85 with HTTP; Tue, 29 Nov 2016 02:21:02 -0800 (PST) In-Reply-To: References: From: immanuel litzroth Date: Tue, 29 Nov 2016 11:21:02 +0100 Message-ID: To: Gabriel Scherer Cc: David Allsopp , OCaML List Mailing Content-Type: multipart/alternative; boundary=94eb2c035ca632cfda05426df355 Subject: Re: [Caml-list] Raising invalid_argument with a constructed string. --94eb2c035ca632cfda05426df355 Content-Type: text/plain; charset=UTF-8 Done. https://caml.inria.fr/mantis/view.php?id=7423 Cheers, Immanuel On Mon, Nov 28, 2016 at 4:50 PM, Gabriel Scherer wrote: > It may make sense to have caml_{failwith,invalid_argument}_value > variants of the exception-raising functions that take a parameter, and > be implemented using caml_raise_with_arg(s) directly instead of > caml_raise_with_string. Could you open a mantis issue or submit a > github pull request to track the question and continue discussion? > > http://caml.inria.fr/mantis/ > https://github.com/ocaml/ocaml/pulls > > On Mon, Nov 28, 2016 at 10:43 AM, David Allsopp > wrote: > > immanuel litzroth wrote: > >> caml_invalid_argument(str) is no return and does not free it's > >> argument. > >> So calling it with a string constructed dynamically will mean it'll > never > >> get freed. > >> I could construct an ocaml string and pass that to caml_raise_with_arg, > >> but I don't seem to be able to get to the caml_exn_Invalid_argument from > >> c. Am I missing something? > > > > Possibly - it's surprising that you want dynamic strings with an > exception such as Invalid_argument which is never supposed to be caught and > similarly with Failure where you shouldn't be matching on the string > argument. > > > > At a push, you can retrieve the Invalid_argument exception from > caml_global_data (see byterun/fail.c), but that is essentially hacking the > runtime to do so... > > > > > > David > > > > -- > > Caml-list mailing list. Subscription management and archives: > > https://sympa.inria.fr/sympa/arc/caml-list > > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > > Bug reports: http://caml.inria.fr/bin/caml-bugs > --94eb2c035ca632cfda05426df355 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

On Mon, Nov 28, 2016 at 4:50 PM, Gab= riel Scherer <gabriel.scherer@gmail.com> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px= #ccc solid;padding-left:1ex">It may make sense to have caml_{failwith,inva= lid_argument}_value
variants of the exception-raising functions that take a parameter, and
be implemented using caml_raise_with_arg(s) directly instead of
caml_raise_with_string. Could you open a mantis issue or submit a
github pull request to track the question and continue discussion?

=C2=A0 http://caml.inria.fr/mantis/
=C2=A0 https://github.com/ocaml/ocaml/pulls

On Mon, Nov 28, 2016 at 10:43 AM, David Allsopp <dra-news@metastack.com> wrote:
> immanuel litzroth wrote:
>> caml_invalid_argument(str) is no return and does not free it's=
>> argument.
>> So calling it with a string constructed dynamically will mean it&#= 39;ll never
>> get freed.
>> I could construct an ocaml string and pass that to caml_raise_with= _arg,
>> but I don't seem to be able to get to the caml_exn_Invalid_arg= ument from
>> c. Am I missing something?
>
> Possibly - it's surprising that you want dynamic strings with an e= xception such as Invalid_argument which is never supposed to be caught and = similarly with Failure where you shouldn't be matching on the string ar= gument.
>
> At a push, you can retrieve the Invalid_argument exception from caml_g= lobal_data (see byterun/fail.c), but that is essentially hacking the runtim= e to do so...
>
>
> David
>
> --
> Caml-list mailing list.=C2=A0 Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group= /ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

--94eb2c035ca632cfda05426df355--