From: Jeremie Dimino <jdimino@janestreet.com>
To: Kenichi Asai <asai@is.ocha.ac.jp>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] a simple example of compiler-libs.toplevel?
Date: Fri, 5 Mar 2021 17:11:42 +0000 [thread overview]
Message-ID: <CANhEzE5tOqq7JXA47tmkQcnF6Bz70eU8jPBT+=+g2EwQ7cNf6Q@mail.gmail.com> (raw)
In-Reply-To: <20210305140334.GA6750@pllab.is.ocha.ac.jp>
[-- Attachment #1: Type: text/plain, Size: 954 bytes --]
On Fri, Mar 5, 2021 at 2:04 PM Kenichi Asai <asai@is.ocha.ac.jp> wrote:
> A side question. How can I find what hooks are available? By looking
> at the source and finding what functions are defined as refs? (I find
> that parse_toplevel_phrase, parse_use_file, and toplevel_startup_hook
> are defined as refs in toploop.ml, so they can be replaced?)
>
That's the idea. Only the refs exposed in the mli can be set from the
outside though.
> What if there is no such hook? For the type debugger, I want to call
> a specific function whenever a type error occurs in the second
> execute_phrase (right after "with exn ->") in toploop.ml. But there
> is no hook there. Since the execute_phrase function is not defined as
> a ref, I cannot replace it, either. What can I do then?
>
If there is no hook, I'm afraid there is no good solution at the moment;
you need to patch the toplevel library, or copy some of its code and modify
it.
--
Jeremie
[-- Attachment #2: Type: text/html, Size: 2121 bytes --]
prev parent reply other threads:[~2021-03-05 17:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-05 5:05 Kenichi Asai
2021-03-05 9:44 ` Jeremie Dimino
2021-03-05 14:03 ` Kenichi Asai
2021-03-05 17:11 ` Jeremie Dimino [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='CANhEzE5tOqq7JXA47tmkQcnF6Bz70eU8jPBT+=+g2EwQ7cNf6Q@mail.gmail.com' \
--to=jdimino@janestreet.com \
--cc=asai@is.ocha.ac.jp \
--cc=caml-list@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