caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Kenichi Asai <asai@is.ocha.ac.jp>
To: Jeremie Dimino <jdimino@janestreet.com>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] a simple example of compiler-libs.toplevel?
Date: Fri, 5 Mar 2021 23:03:34 +0900	[thread overview]
Message-ID: <20210305140334.GA6750@pllab.is.ocha.ac.jp> (raw)
In-Reply-To: <CANhEzE500WBfKuJaML35XECExZoa-oHHMXyhSq-sFV418oJJCA@mail.gmail.com>

Thanks for the e-mail, Jeremie!

Your example first modifies Toploop.read_interactive_input and then
calls the original Topmain.main.  Because toploop.ml had a hook for
reading interactive input, we could change the character for the
prompt.

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?)

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?

-- 
Kenichi Asai

  reply	other threads:[~2021-03-05 14:04 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 [this message]
2021-03-05 17:11     ` Jeremie Dimino

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=20210305140334.GA6750@pllab.is.ocha.ac.jp \
    --to=asai@is.ocha.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=jdimino@janestreet.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;
as well as URLs for NNTP newsgroup(s).