Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007663OCamltypingpublic2017-10-28 11:192018-04-04 21:16
Assigned Tooctachron 
PlatformOSOS Version
Product Version4.05.0 
Target VersionFixed in Version4.07.0+dev/beta2/rc1/rc2 
Summary0007663: suboptimal error message
DescriptionAt some point, when I was trying to compile my program, I got this error message:

  Error: Cannot safely evaluate the definition
         of the recursively-defined module Foo

Unless the user read Section 7.4 of the reference manual
and deduces that "safe evaluation" might be something closely related to "safe module", I do not think that this error message could be of much help to the user.

Since this topic is subtle (one needs to understand what implementors of Ocaml mean by "safe module" and that this is (somehow) closely related to "safe evaluation" so I think it would make sense if the error message referred the user for further information to the corresponding place (Section 7.4 of the User's Manual).

It would be very helpful if Section 7.4 showed:
- examples of "unsafe recursive modules"
- showed what kind of error messages the user then should expect to see
  ("Cannot safely evaluate the definition of the recursively-defined module Foo")
- and show how, in a given concrete situation, recursive modules can be converted to "safe ones".

The most trivial situation I was able to trigger the error (which confused me completely) is this:

  module rec M1 :
      val f1 : unit
    end = struct
      let f1 = ()
      let f2 = M2.f1

  and M2 :
      val f1 : unit
    end = struct
      let f1 = ()
      let f2 = M1.f1

It would be illustrative to show the necessary workaround that enables one to compile programs like these.
(I.e. changing the type of "M1.f1" to "unit -> unit" or the type of "M2.f1" to "unit -> unit".)

Please consider this as a subjective feedback as this is not really a rigorous area. I am curious what do you think.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
octachron (developer)
2017-10-31 17:43

It sounds very reasonable to me to have a reference to the relevant section of the manual in the error message itself in these subtle cases, and having examples of code raising such errors could be nice.
octachron (developer)
2018-04-03 22:12

See [^] .
octachron (developer)
2018-04-04 21:16

The PR above was merged, fixing this issue.

- Issue History
Date Modified Username Field Change
2017-10-28 11:19 kosik New Issue
2017-10-31 17:40 octachron Assigned To => octachron
2017-10-31 17:40 octachron Status new => assigned
2017-10-31 17:43 octachron Note Added: 0018634
2018-04-03 22:12 octachron Note Added: 0018973
2018-04-04 21:16 octachron Note Added: 0018974
2018-04-04 21:16 octachron Status assigned => resolved
2018-04-04 21:16 octachron Fixed in Version => 4.07.0+dev/beta2/rc1/rc2
2018-04-04 21:16 octachron Resolution open => fixed

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker