Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006305OCamltypingpublic2014-01-24 17:462017-03-15 11:34
ReporterJulien Signoles 
Assigned Togarrigue 
PlatformOSOS Version
Product Version4.00.1 
Target VersionFixed in Version 
Summary0006305: Namespace pollution when using 'module type of' in an explicit interface for a pack
Description=== ===
let x = 0
=== p.mli ===
module A: module type of A
==== q.mli ===
module A: sig val x: int end (* equivalent (?) to p.mli *)

$ ocamlc -c
$ ocamlc -c p.mli
$ ocamlc -o p.cmo -pack a.cmo
$ ocamlobjinfo p.cmi
File p.cmi
Unit name: P
Interfaces imported:
    aab12b8603ccba471f3d2352b15b1331 P
    7e0edf9c5f96b410a30ce34a6431a15b A
    4836c254f0eacad92fbf67abc525fdda Pervasives
$ ocamlc -c q.mli
$ ocamlc -o q.cmo -pack a.cmo
$ ocamlobjinfo q.cmi
File q.cmi
Unit name: Q
Interfaces imported:
    1126f1d48cd89cc39040dfe4e143dfa6 Q
    4836c254f0eacad92fbf67abc525fdda Pervasives

I think P and Q should be equivalent but A is visible in P (polluting namespace) and not in Q.
TagsNo tags attached.
Attached Files

- Relationships
has duplicate 0006433acknowledgedgarrigue Wrong module type signature grabbed when using packed libraries 
related to 0006304acknowledgedgarrigue Explicit interface for a pack, "module type of" and type generativity 

-  Notes
garrigue (manager)
2014-01-26 11:09

The cause is clear: p.mli does refer to A.
By the semantics of OCaml, this cannot be the A in the packed module (which is not defined yet), but some external one.

This said, you have a point that 'module type of' is special: it just defines a new module type, which is not directly tied to A, so there would be no problem in not introducing this dependency.
This could be doable in trunk, where the -trans-mod flag works at weakening module dependencies.
xleroy (administrator)
2015-11-23 15:41

Any new developments about this PR?
shinwell (developer)
2016-12-07 18:43

Jacques: ping

- Issue History
Date Modified Username Field Change
2014-01-24 17:46 Julien Signoles New Issue
2014-01-26 11:09 garrigue Note Added: 0010846
2014-01-26 11:09 garrigue Assigned To => garrigue
2014-01-26 11:09 garrigue Status new => feedback
2014-02-19 20:30 doligez Relationship added related to 0006325
2014-05-20 04:57 garrigue Relationship added has duplicate 0006433
2014-05-31 15:49 garrigue Relationship added related to 0006304
2014-07-16 17:35 doligez Target Version => 4.03.0+dev / +beta1
2015-11-23 15:41 xleroy Note Added: 0014801
2016-04-05 15:26 doligez Target Version 4.03.0+dev / +beta1 => 4.03.1+dev
2016-12-07 18:43 shinwell Category OCaml general => OCaml typing
2016-12-07 18:43 shinwell Note Added: 0016797
2017-02-16 14:00 doligez Target Version 4.03.1+dev => undecided
2017-02-23 16:45 doligez Category OCaml typing => typing
2017-03-15 11:34 doligez Target Version undecided =>

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker