arenadotio / pgx

A pure OCaml PostgreSQL client library
Other
122 stars 15 forks source link

Module name clash #101

Closed rdavison closed 4 years ago

rdavison commented 4 years ago

It looks like the (wrapped false) setting in pgx/src/dune is causing me some problem when using Pgx in a local project.

Some environment information:

Error message:

$ esy dune build @all
Entering directory '/home/richard/code/project'
File "_none_", line 1:
Error: Files /home/richard/.esy/3__________________________________________________________________/i/ocaml-4.9.1000-ffe51dac/lib/ocaml/compiler-libs/ocamlcommon.cmxa
       and /home/richard/.esy/3__________________________________________________________________/i/opam__s__pgx-opam__c__1.0-1d851550/lib/pgx/pgx.cmxa
       both define a module named Types

Diagnosis:

$ esy ls-modules | grep -A4 -B9 Types
info ls-modules 0.6.4 (using esy.json) found project at ~/code/project/
├── @opam/pgx@opam:1.0 [built]
│   └── pgx
│       ├── Pgx
│       ├── Io_intf
│       ├── Pgx_intf
│       ├── Isolation
│       ├── Access
│       ├── Result_desc
│       ├── Row_desc
│       ├── Types
│       ├── Pgx_value_intf
│       ├── Pgx_value
│       ├── Error_response
│       └── Pgx_aux

It looks like some internal library in the compiler defines and exports a Types module, and so does Pgx. When I checked the Dune documentation, I saw that (wrapped false) is discouraged, but if you do want to use it, they recommend prefixing all the modules in your library manually.

brendanlong commented 4 years ago

Thanks for bring this up. This is definitely a mistake and that module shouldn't be exported.