Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler-libs.common being loaded again in REPL #65

Open
aqjune opened this issue May 31, 2023 · 0 comments
Open

compiler-libs.common being loaded again in REPL #65

aqjune opened this issue May 31, 2023 · 0 comments

Comments

@aqjune
Copy link

aqjune commented May 31, 2023

Hello all,

I am trying to use the Env module in compiler-libs.common (link: https://ocaml.org/p/ocaml-base-compiler/4.14.1/doc/Env/index.html) , which was expunged from the recent toplevel.
In order to use this, I am building a new REPL using ocamlmktop which links compiler-libs to the REPL, and this resolves the issue.
However, if I load some library, e.g., camlp5, using Topfind.load_deeply, it loads compiler-libs.common again, making the REPL unable to use Env:

# Topdirs.dir_use Format.std_formatter "topfind";;
(snip)
# Topfind.load_deeply ["camlp5"];;
.../_opam/lib/ocaml/compiler-libs: added to search path
.../_opam/lib/ocaml/compiler-libs/ocamlcommon.cma: loaded <- this again loads ocamlcommon.cma
(snip)
# let x = Env.lookup_value ~use:true ~loc:Location.none Longident.(Ldot(Lident "Bytes", "get")) !Toploop.toplevel_env;;
Exception:
Env.Error
 (Env.Lookup_error
   ({Location.loc_start =
      {Lexing.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1};
     loc_end =
      {Lexing.pos_fname = "_none_"; pos_lnum = 0; pos_bol = 0; pos_cnum = -1};
     loc_ghost = true},
   <abstr>,
   Env.Cannot_scrape_alias (Longident.Lident "Bytes", Path.Pident <abstr>))).

ocaml/ocaml#12271 has more details about the error.

In order to resolve this error, I am relying on Topfind.don't_load ["compiler-libs.common"]. It works, but it would be great if compiler-libs.common is not loaded by default because it is already available in the toplevel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant