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

first class modules don't allow "with type" declarations for types in sub-modules #5358

Closed
vicuna opened this issue Sep 20, 2011 · 3 comments
Assignees
Labels

Comments

@vicuna
Copy link

vicuna commented Sep 20, 2011

Original bug ID: 5358
Reporter: yminsky
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2012-09-25T18:07:21Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.12.1
Fixed in version: 3.13.0+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: sigonnea mehdi @jberdine @hcarty @Chris00

Bug description

For some reason, 1st-class modules have more restrictive "with" syntax, which turns out to be a practical problem.

The main constraint is that with constraints do not seem to be able to refer to sub-modules. Consider the following code snippet:

module type Foo = sig type t end
module type Bar = sig module Foo : Foo end

(* compiles *)
let g (type a) (m : (module Foo with type t = a)) = ()

(* fails to compile with a syntax error *)
let f (type a) (m : (module Bar with type Foo.t = a)) = ()

It would be nice to lift this restriction. (Also, allowing "with module" declarations would be good.)

Additional information

There's a thread discussing this initiated by this message:

https://sympa-roc.inria.fr/wws/arc/caml-list/2011-09/msg00158.html

with a useful explanation by Alain Frisch here:

https://sympa-roc.inria.fr/wws/arc/caml-list/2011-09/msg00162.html

@vicuna
Copy link
Author

vicuna commented Dec 14, 2011

Comment author: @alainfrisch

Wish granted (commit 11311).

Camlp4 compiles but cannot parses the new feature.

TODO:

  • adapt the manual
  • adapt Camlp4

@vicuna
Copy link
Author

vicuna commented Dec 16, 2011

Comment author: @diml

I updated Camlp4 (commit 11320).

@vicuna
Copy link
Author

vicuna commented Dec 16, 2011

Comment author: @alainfrisch

Thanks Jérémie. I've updated the manual, so feel free to mark the issue as resolved if you're confident in the camlp4 update.

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

No branches or pull requests

2 participants