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

Add an OCAML_TOPLEVEL_PATH variable to ocaml #7808

Closed
vicuna opened this issue Jun 14, 2018 · 6 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link

commented Jun 14, 2018

Original bug ID: 7808
Reporter: @dbuenzli
Assigned to: @nojb
Status: resolved (set by @nojb on 2018-12-02T15:07:39Z)
Resolution: fixed
Priority: normal
Severity: feature
Version: 4.06.1
Fixed in version: 4.08.0+dev/beta1/beta2
Category: toplevel
Monitored by: @nojb @gasche @dbuenzli

Bug description

In the new world of opam and its system and non-system switches allowing both:

ocaml

#use "topfind"

and

#!/usr/bin/env ocaml
#use "topfind"

to work correctly has proven to be a dire source of hacks and workarounds (I can provide full details if one needs to be convinced).

It turns out that letting the ocaml binary be affected by an OCAML_TOPLEVEL_PATH variable, whose semantics would simply be to add the colon separated directories to the includes (#directory include) would allow us to get rid of all of these hacks.

Slightly related to #7770

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 14, 2018

Comment author: @nojb

Note that you can already do this today by using OCAMLPARAM, e.g.

OCAMLPARAM=I=,I=,_ ocaml

will result in and to be added to the list of include directories.

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 14, 2018

Comment author: @dbuenzli

Sure but I'd rather not use OCAMLPARAM for that as it affects all the ocaml tools and may be used by switches for other purposes.

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 14, 2018

Comment author: @gasche

The request seems sensible to me, but I think that the current name is a bit misleading (to me it says where to find the toplevel binary), I would expect INCLUDE_PATH to be in the name.

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 14, 2018

Comment author: @dbuenzli

Agreed on the name, I just reused what opam devs initially used. Here are a few candidates

OCAML_INCLUDE_PATH
OCAMLTOP_INCLUDE_PATH
OCAML_TOPLEVEL_INCLUDE_PATH
OCAML_TOP_INCLUDE_PATH
OCAML_REPL_INCLUDE_PATH

Logic would go for OCAML_INCLUDE_PATH but this could be mistaken as applying to the compilers or one might want to reserve it for that purpose to follow the example of C_INCLUDE_PATH.

Maybe OCAMLTOP_INCLUDE_PATH ?

@vicuna

This comment has been minimized.

Copy link
Author

commented Jun 15, 2018

Comment author: @nojb

#1841

@vicuna

This comment has been minimized.

Copy link
Author

commented Dec 2, 2018

Comment author: @nojb

Merged, will be in 4.08.

@vicuna vicuna closed this Dec 2, 2018

@vicuna vicuna added the toplevel label Mar 14, 2019

@vicuna vicuna added the feature-wish label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.