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

Typing problem with recursive modules #5006

Closed
vicuna opened this issue Mar 22, 2010 · 6 comments
Closed

Typing problem with recursive modules #5006

vicuna opened this issue Mar 22, 2010 · 6 comments

Comments

@vicuna
Copy link

vicuna commented Mar 22, 2010

Original bug ID: 5006
Reporter: @alainfrisch
Status: acknowledged (set by @xavierleroy on 2012-08-06T16:27:00Z)
Resolution: open
Priority: normal
Severity: feature
Target version: later
Category: typing
Tags: recmod
Monitored by: @jberdine "Julien Signoles" @yakobowski

Bug description

The following is rejected:

module rec X : sig
type t
module type S = sig val x: t end
end = struct
type t
module type S = X.S
end

Same for "val x: X.t" instead of "val x: t".

But if we replace X.S with "sig include X.S end", then it works fine.

Is it the expected behavior?

Are there cases where replacing a reference to a signature S by "sig include S end" breaks code?

@vicuna
Copy link
Author

vicuna commented Aug 6, 2012

Comment author: @xavierleroy

I've been sleeping on these PR for too long, and still have no idea how to address them. Unassigning them from myself.

@vicuna
Copy link
Author

vicuna commented Aug 6, 2012

Comment author: @alainfrisch

Xavier: do you have an opinion about the "S -> sig include S end" rewriting? Do you understand why it makes this code type-checks? Could this be applied systematically, or could it break something?

@vicuna
Copy link
Author

vicuna commented Mar 14, 2017

Comment author: @garrigue

There is no specification of recursive modules, so this is not a bug :-)

@vicuna
Copy link
Author

vicuna commented Mar 14, 2017

Comment author: @alainfrisch

This is a slippery slope (even with the smiley). I understand the feature is experimental, but as far as I know, the lack of specification is a property of the entire system, not just of this feature.

@vicuna
Copy link
Author

vicuna commented Mar 14, 2017

Comment author: @garrigue

There is no formal specification of OCaml, but there is an intended behavior, and some people have even provided formal specification for parts of it.
But recursive modules explicitly lack a specification. So they really differ from the rest of the language. (To be precise, some subtle interactions between polymorphic variants and modules/first class polymorphism are unspecified too)

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

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