caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Alain Frisch <alain.frisch@lexifi.com>
To: "Nicolás Ojeda Bär" <nicolas.ojeda.bar@lexifi.com>,
	"Jocelyn Sérot" <Jocelyn.Serot@univ-bpclermont.fr>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] A question about custom toplevels
Date: Thu, 8 Mar 2018 18:28:29 +0100	[thread overview]
Message-ID: <701b5731-23d5-3e31-bf3a-5ec21867aa02@lexifi.com> (raw)
In-Reply-To: <CADK7aFPW_TSgX-f61upapH1UCBNwim4GGRptB=VUN+_YmwuhZw@mail.gmail.com>

On 08/03/2018 15:18, Nicolás Ojeda Bär wrote:
> I do not think this is currently possible.
> 
> When you enter a phrase into the toplevel (custom or otherwise), it is
> compiled much the same way as if it had been written in a file and
> passed to ocamlc.
> To do so the compiler needs access to the signature information stored
> in the .cmi files of all referenced modules. This is completely
> independent of whether the code of those modules is linked into the
> toplevel or loaded separately which is what ocamlmktop is about.


The Env module has the following:

=======================================================
module Persistent_signature : sig
   type t =
     { filename : string; (** Name of the file containing the signature. *)
       cmi : Cmi_format.cmi_infos }

   (** Function used to load a persistent signature. The default is to 
look for
       the .cmi file in the load path. This function can be overridden 
to load
       it from memory, for instance to build a self-contained toplevel. *)
   val load : (unit_name:string -> t option) ref
end
=======================================================

This makes it possible to create a custom toplevel with some "embedded" 
.cmi files.

-- Alain

  parent reply	other threads:[~2018-03-08 17:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-08  8:19 Jocelyn Sérot
2018-03-08 14:18 ` Nicolás Ojeda Bär
2018-03-08 16:01   ` Jocelyn Sérot
2018-03-08 17:28   ` Alain Frisch [this message]
2018-03-12  5:50     ` Oleg

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=701b5731-23d5-3e31-bf3a-5ec21867aa02@lexifi.com \
    --to=alain.frisch@lexifi.com \
    --cc=Jocelyn.Serot@univ-bpclermont.fr \
    --cc=caml-list@inria.fr \
    --cc=nicolas.ojeda.bar@lexifi.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).