From: immanuel litzroth <ilitzroth@gmail.com>
To: Gabriel Scherer <gabriel.scherer@gmail.com>
Cc: David Allsopp <dra-news@metastack.com>,
OCaML List Mailing <caml-list@inria.fr>
Subject: Re: [Caml-list] Raising invalid_argument with a constructed string.
Date: Tue, 29 Nov 2016 11:21:02 +0100 [thread overview]
Message-ID: <CAJjmLU7KT-Ep_g6xhqS0=Xh1r4htx+rCPsYOPOGaFLCscNvJZA@mail.gmail.com> (raw)
In-Reply-To: <CAPFanBGRdRzzXG-u_GYsHzVqnG9OwqJGA_6Wr7XF_WEyXufNBg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1726 bytes --]
Done.
https://caml.inria.fr/mantis/view.php?id=7423
Cheers,
Immanuel
On Mon, Nov 28, 2016 at 4:50 PM, Gabriel Scherer <gabriel.scherer@gmail.com>
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 <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'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
>
[-- Attachment #2: Type: text/html, Size: 2929 bytes --]
next prev parent reply other threads:[~2016-11-29 10:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-28 14:39 immanuel litzroth
2016-11-28 15:43 ` David Allsopp
2016-11-28 15:50 ` Gabriel Scherer
2016-11-29 10:21 ` immanuel litzroth [this message]
2016-12-03 13:20 ` Richard W.M. Jones
2016-12-03 14:00 ` immanuel litzroth
2016-12-03 19:36 ` Richard W.M. Jones
2016-12-03 19:44 ` Gabriel Scherer
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='CAJjmLU7KT-Ep_g6xhqS0=Xh1r4htx+rCPsYOPOGaFLCscNvJZA@mail.gmail.com' \
--to=ilitzroth@gmail.com \
--cc=caml-list@inria.fr \
--cc=dra-news@metastack.com \
--cc=gabriel.scherer@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