Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006305OCamlOCaml generalpublic2014-01-24 17:462014-02-19 20:30
ReporterJulien Signoles 
Assigned Togarrigue 
PrioritynormalSeverityminorReproducibilityalways
StatusfeedbackResolutionopen 
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=== a.ml ===
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 a.ml
$ 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

-  Notes
(0010846)
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.

- 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


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker