thierry-martinez / stdcompat

Stdcompat: compatibility module for OCaml standard library
BSD 2-Clause "Simplified" License
31 stars 13 forks source link

Do not wrap stdcompat modules (as they are already prefixed with Stdcompat__) #21

Closed kit-ty-kate closed 2 years ago

kit-ty-kate commented 2 years ago

Otherwise it creates accessible modules as Stdcompat__stdcompat__<module> which seems unnecessarily long. This would allow compatibility with the old style as well. e.g. Stdcompat__format found in override.0.4.0

thierry-martinez commented 2 years ago

Thank you for your suggestion. I already tried to add (wrapped false) following your suggestion in https://github.com/ocaml/opam-repository/pull/21749#issuecomment-1177668371 but I am facing compilation problems that I don't know yet how to solve.

By adding (wrapped false), I get this compilation error on OCaml 4.14:

File "stdcompat__stdlib_s.ml", line 1:    
Error: The implementation stdcompat__stdlib_s.ml
       does not match the interface stdcompat__stdlib_s.cmi:  ... ...
       The exception `Match_failure' is required but not provided
       The exception `Assert_failure' is required but not provided
       The exception `Invalid_argument' is required but not provided
       The exception `Failure' is required but not provided
       The exception `Not_found' is required but not provided
       The exception `Out_of_memory' is required but not provided
       The exception `Stack_overflow' is required but not provided
       The exception `Sys_error' is required but not provided
       The exception `End_of_file' is required but not provided
       The exception `Division_by_zero' is required but not provided
       The exception `Sys_blocked_io' is required but not provided
       The exception `Undefined_recursive_module' is required but not provided
       The value `&' is required but not provided
       File "stdlib.mli", lines 221-222, characters 0-42:
         Expected declaration
       The value `or' is required but not provided
       File "stdlib.mli", lines 234-235, characters 0-42:
         Expected declaration
       The value `__FUNCTION__' is required but not provided
       File "stdlib.mli", line 276, characters 0-48: Expected declaration
       The value `unsafe_really_input' is required but not provided
       File "stdlib.mli", line 1376, characters 0-67: Expected declaration
       The module `Genlex' is required but not provided
       File "stdlib.mli", lines 1446-1447, characters 0-55:
         Expected declaration
       The module `Marshal' is required but not provided
       File "stdlib.mli", line 1480, characters 0-32: Expected declaration
       The module `MoreLabels' is required but not provided
       File "stdlib.mli", line 1483, characters 0-38: Expected declaration
       At position module type S = <here>
       The module `Stream' is required but not provided
       File "stdlib.mli", lines 1541-1542, characters 0-55:
         Expected declaration
File "stdcompat__stdlib.ml", line 1:    
Error: The implementation stdcompat__stdlib.ml
       does not match the interface stdcompat__stdlib.cmi: 
       The exception `Match_failure' is required but not provided
       The exception `Assert_failure' is required but not provided
       The exception `Invalid_argument' is required but not provided
       The exception `Failure' is required but not provided
       The exception `Not_found' is required but not provided
       The exception `Out_of_memory' is required but not provided
       The exception `Stack_overflow' is required but not provided
       The exception `Sys_error' is required but not provided
       The exception `End_of_file' is required but not provided
       The exception `Division_by_zero' is required but not provided
       The exception `Sys_blocked_io' is required but not provided
       The exception `Undefined_recursive_module' is required but not provided
       The value `&' is required but not provided
       File "stdlib.mli", lines 221-222, characters 0-42:
         Expected declaration
       The value `or' is required but not provided
       File "stdlib.mli", lines 234-235, characters 0-42:
         Expected declaration
       The value `unsafe_really_input' is required but not provided
       File "stdlib.mli", line 1376, characters 0-67: Expected declaration
       The module `Stream' is required but not provided
       File "stdlib.mli", lines 1541-1542, characters 0-55:
         Expected declaration

and this compilation error with other versions (I tried OCaml 4.12, OCaml 4.13, OCaml 5.0, each time with dune clean first):

File "stdcompat.mli", line 1:            
Error: stdcompat__init.cmi
       is not a compiled interface for this version of OCaml.
It seems to be for an older version of OCaml.

(and the same message for nearly all the source files of stdcompat).

I am still trying to see how to fix this.

kit-ty-kate commented 2 years ago

I’m not getting those issues. That looks like some sort of remaining conflicting artefacts. Could you try again with git clean -xdf before?

thierry-martinez commented 2 years ago

Indeed, git clean -xdf solves this problem (I am surprised that dune clean was not enough...). Thank you very much! I will merge.