This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
|
|
@ -0,0 +1,7 @@
|
|||
(executable
|
||||
(name test)
|
||||
(libraries foo_impl))
|
||||
|
||||
(alias
|
||||
(name default)
|
||||
(action (run ./test.exe)))
|
||||
|
|
@ -0,0 +1 @@
|
|||
(lang dune 1.7)
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
let run () =
|
||||
Priv.run ();
|
||||
print_endline "implementing bar"
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
(library
|
||||
(name foo_impl)
|
||||
(private_modules priv)
|
||||
(implements foo))
|
||||
|
|
@ -0,0 +1 @@
|
|||
let run () = print_endline "Private module Baz"
|
||||
|
|
@ -0,0 +1 @@
|
|||
val run : unit -> unit
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
They can only introduce private modules:
|
||||
$ dune build --debug-dependency-path
|
||||
Private module Baz
|
||||
implementing bar
|
||||
|
||||
Note the aliasing scheme for implementations differs form other libraries. In
|
||||
particular, we use a longer prefix for private modules of implementations so
|
||||
that they never collide with modules present in the virtual library.
|
||||
|
||||
$ cat _build/default/impl/foo__foo_impl__.ml-gen
|
||||
(* generated by dune *)
|
||||
|
||||
(** @canonical Foo.Bar *)
|
||||
module Bar = Foo__Bar
|
||||
|
||||
(** @canonical Foo.Priv *)
|
||||
module Priv = Foo__foo_impl__Priv
|
||||
|
||||
Here we look at the raw artifacts for our implementation and verify it matches
|
||||
the alias:
|
||||
|
||||
$ ls _build/default/impl/.foo_impl.objs/byte/*.cmi
|
||||
_build/default/impl/.foo_impl.objs/byte/foo__Bar.cmi
|
||||
_build/default/impl/.foo_impl.objs/byte/foo__foo_impl__.cmi
|
||||
_build/default/impl/.foo_impl.objs/byte/foo__foo_impl__Priv.cmi
|
||||
|
|
@ -0,0 +1 @@
|
|||
let () = Foo.Bar.run ()
|
||||
|
|
@ -0,0 +1 @@
|
|||
val run : unit -> unit
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
(library
|
||||
(name foo)
|
||||
(virtual_modules bar))
|
||||
Loading…
Add table
Add a link
Reference in a new issue