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

Support for local signatures #6370

Closed
vicuna opened this issue Apr 14, 2014 · 3 comments
Closed

Support for local signatures #6370

vicuna opened this issue Apr 14, 2014 · 3 comments

Comments

@vicuna
Copy link

vicuna commented Apr 14, 2014

Original bug ID: 6370
Reporter: @samoht
Assigned to: @garrigue
Status: closed (set by @alainfrisch on 2014-04-16T16:39:47Z)
Resolution: won't fix
Priority: normal
Severity: minor
Version: 4.01.0
Category: typing
Monitored by: @hcarty

Bug description

Would be great to be able to write:

let f (type a) ... =

   let module S = Foo.S with type t = a in
   ...
   let (module M: S) = .... in
   ...
@vicuna
Copy link
Author

vicuna commented Apr 14, 2014

Comment author: @samoht

Sorry, I meant to say let module type S = Foo.S with type t = a in

@vicuna
Copy link
Author

vicuna commented Apr 15, 2014

Comment author: @garrigue

Can you provide a concrete use case?
Your example doesn't really make sense, since you are using the fresh signature to unpack a first class module, and it can only be unpacked with its original signature.
Or is the goal just to avoid typing "with type ..." repeatedly?

Note that with the current approach to first class modules, this extension would be problematic, because if you pack a first-class module with a local signature you have to check that is doesn't leak outside.
If we further relax the restriction on first-class modules, so that the signature doesn't need to be predefined, it would be possible to just expand the signature in that case, but this is another language change.

@vicuna
Copy link
Author

vicuna commented Apr 15, 2014

Comment author: @samoht

Yes the goal is just to avoid to repeat the typing of with type t = a multiple times which can become very verbose if you have more multiple type variable you want to bind and multiple first-class module you want to unpack as arguments.

But yes, you are right, I'm not able to write a simple (but verbose) use-case where the typer is happy, so I'm not sure ... Feel free to close the issue then.

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