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
unhelpful error message #7641
Comments
Comment author: @gasche My understanding of OCaml's recursive modules is that it looks for modules that are safe to compile even if the names it recursively depends on are not yet defined (they will not be required to evaluate the values exposed by the module itself). This criterion is approximated by the following, more restrictive one: of the modules evaluates only contain function values -- functions do not evaluate their body when they are evaluated. The following code would therefore be accepted:
It would be possible to relax this condition, but my experience is that OCaml language designers are very conservative about changes to recursive modules, that tend to make things more complex and more fragile. If you want to motivate a change on this front, you better have a highly motivating real-life example that it is clearly important to support. (It's an interesting question to know whether Jeremy Yallop's new letrec-on-values check could be used to make the module checking more permissive. It's related to the comparison with related work in the module literature, so it is on our TODO-list.) |
Comment author: kosik That is interesting (and thus I am surprised a bit more after learning that the second snippet compiles while the former does not). In any case, I am primarily suggesting making the error message more to the point. |
Note that the error message looks like on 4.08:
Which I believe is due to #2058. I'll let @Octachron and @gasche decide if this is good enough to close this issue. |
@Octachron will be too modest to declare his own work (improving the message) "good enough", so let me do it. It's good enough, and actually it's quite good given the restricted space budget we have. |
Original bug ID: 7641
Reporter: kosik
Status: acknowledged (set by @xavierleroy on 2017-09-29T18:06:12Z)
Resolution: open
Priority: low
Severity: minor
Version: 4.05.0
Category: typing
Monitored by: @gasche @yallop
Bug description
When one tries to compile the following program:
the compiler complains:
The error message is suboptimal (I think) in the following ways:
and thus (in a non-trivial scenario) I found it difficult to
figure out what I needed to do.
File attachments
The text was updated successfully, but these errors were encountered: