Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespace pollution when using 'module type of' in an explicit interface for a pack #6305

Closed
vicuna opened this issue Jan 24, 2014 · 7 comments
Assignees

Comments

@vicuna
Copy link

vicuna commented Jan 24, 2014

Original bug ID: 6305
Reporter: Julien Signoles
Assigned to: @garrigue
Status: feedback (set by @garrigue on 2014-01-26T10:09:04Z)
Resolution: open
Priority: normal
Severity: minor
Version: 4.00.1
Category: typing
Has duplicate: #6433
Related to: #6304 #6325
Monitored by: @gasche @diml @hcarty @yakobowski

Bug 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.

@vicuna
Copy link
Author

vicuna commented Jan 26, 2014

Comment author: @garrigue

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.

@vicuna
Copy link
Author

vicuna commented Nov 23, 2015

Comment author: @xavierleroy

Any new developments about this PR?

@vicuna
Copy link
Author

vicuna commented Dec 7, 2016

Comment author: @mshinwell

Jacques: ping

@vicuna
Copy link
Author

vicuna commented Oct 15, 2017

Comment author: @xavierleroy

Again: Any new developments about this PR?

@vicuna
Copy link
Author

vicuna commented Oct 16, 2017

Comment author: @garrigue

Thanks for the ping. I'll have one more look into this.

@github-actions
Copy link

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

@github-actions github-actions bot added the Stale label May 13, 2020
@garrigue
Copy link
Contributor

Close it in favour of duplicate #6433, which has a better discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants