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

Can library linking proposal be extended to formalise package name? #18

Closed
bikallem opened this issue Jun 2, 2020 · 2 comments
Closed

Comments

@bikallem
Copy link

bikallem commented Jun 2, 2020

In the ocamlib RFC, it seems the name of the package name/lib name has been formalized. I am wondering if this proposal can be extended to further formalize how one can access modules/types with such library.

For example,
Let's say lib ptime.clock.jsoo defines modules A, B and C. In my hello.exe application I add reference to it from my dune file like so,

(executable 
   (name hello)
   (libraries ptime.clock.jsoo))

Now, in my hello.ml file, ocaml would enforce the lib namespace such that to access any modules in ptime.clock.jsoo, I would access the modules in it like so,

open Ptime.Clock.Jsoo   

let () = A.hello()

of a full path

let () = Ptime.Clock.Jsoo.A.hello()

At the moment Dune (by default) implements a similar mechanism where in a lib_name also serves as its toplevel namespace but doesn't take into account . in the module path name.

[1] https://github.com/ocaml/RFCs/blob/master/rfcs/ocamlib.md#libraries-and-ocamlpath

@bikallem
Copy link
Author

bikallem commented Jul 6, 2020

@dbuenzli

@dbuenzli
Copy link
Contributor

dbuenzli commented Jul 6, 2020

Namespacing is not in the scope of the proposal. Rather, it paves the way to it.

@bikallem bikallem closed this as completed Mar 8, 2021
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

2 participants