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

Ppx_tools not working in uTop 2.0.1 #213

Open
mseri opened this issue Jun 8, 2017 · 10 comments
Open

Ppx_tools not working in uTop 2.0.1 #213

mseri opened this issue Jun 8, 2017 · 10 comments

Comments

@mseri
Copy link

mseri commented Jun 8, 2017

As mentioned in https://discuss.ocaml.org/t/ppx-tools-not-working-in-utop/367
The new utop has a problem with ppx_tools:

$ utop -require ppx_tools
File "_none_", line 1:
Error: Reference to undefined global `Longident'

I think it's an issue with utop. The following set of packages works without problems

ocamlfind       1.7.3  A library manager for OCaml
ppx_tools  5.0+4.03.0  Tools for authors of ppx rewriters and other syntactic tools
utop           1.19.3 (pinned)  Universal toplevel for OCaml

while this other presents the issue we both saw:

ocamlfind       1.7.3  A library manager for OCaml
ppx_tools  5.0+4.03.0  Tools for authors of ppx rewriters and other syntactic tools
utop            2.0.1 (pinned)  Universal toplevel for OCaml
@ghost
Copy link

ghost commented Jun 9, 2017

It's because utop 2.0.1 declares its dependency on compiler-libs while the older version did not.

Technically this is a very obscure problem; the compiler libraries contain a lot of generic root modules (Misc, Path, ...) that are very likely to clash with root modules from user libraries and the OCaml toplevel uses the compiler libraries. As a result the OCaml toplevel is expunged, i.e. the modules from the compiler libraries are made hidden from what the user can use inside the toplevel. utop does the same.

ppx_tools uses the compiler libraries as well, but because utop thinks they are already available as the utop library depends on them, it doesn't try to load them again. There is probably a complicated way around this.

Alternatively, you can try utop-full which is not expunged. The only limitation is that you cannot load root modules such as Misc or Path in it.

@reynir
Copy link

reynir commented Jun 15, 2017

I'm seeing this issue in reynir/ocp-index-top#9 as well. It's a toplevel directive for looking up documentation for identifiers. Do you have any advice on making it work in utop? I have an issue about inadverdently exposing compiler-libs, so I understand the motivation for the change in utop 2.0.1 reynir/ocp-index-top#1. Thanks!

@ghost
Copy link

ghost commented Jun 15, 2017

Well, appart from using utop-full I'm not sure. We could restore the previous behavior that allowed to load the compiler libs in utop, but this was causing other bugs. The real solution would be to just not expunge utop, but then the name clashes might be a problem. Hopefully this will be sorted when we get namespaces in OCaml and can namespace the compiler libraries.

@let-def
Copy link

let-def commented Jun 19, 2017

Same problem here, reason toplevel built on top of utop stopped working.

The dependency chain is:
reason -> ocaml-migrate-parsetree -> compiler-libs.common -> Misc.
Resulting in Error: Reference to undefined global `Misc'.

@ghost
Copy link

ghost commented Jun 26, 2017

How is the reason toplevel built? If you link a custom toplevel, you should only get this error if you expunge the toplevel

@let-def
Copy link

let-def commented Jun 26, 2017

It's utop with a custom init that replaces parsing and printing.

@ghost
Copy link

ghost commented Jun 26, 2017

Maybe it should be a custom toplevel instead?

@let-def
Copy link

let-def commented Jul 28, 2017

Maybe. In the meantime we are happy with utop-full. Thanks.

@XVilka
Copy link
Contributor

XVilka commented Nov 13, 2018

@diml is there any issue/PR to track the namespacing of the compiler libs?

@ghost
Copy link

ghost commented Nov 13, 2018

There is this ticket that's related: https://caml.inria.fr/mantis/view.php?id=6704

Namespacing the compiler libs like the stdlib would be nice, though it's likely to be a little bit painful to adapt the makefiles.

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

4 participants