Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005538OCaml~DO NOT USE (was: OCaml general)public2012-03-14 02:242012-03-27 17:11
Assigned To 
PrioritynormalSeverityfeatureReproducibilityhave not tried
PlatformOSOS Version
Product Version3.13.0+dev 
Target VersionFixed in Version4.00.0+dev 
Summary0005538: combining -i and -annot
DescriptionCurrently ocamlc -i disables any output to files.
It would be nice that combining -i and -annot would still generate the .annot file,
so that one get all the typing information without actually compiling.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
gasche (developer)
2012-03-14 06:27

I have a related request: I recently noticed that `ocamlc -i` working fine does not actually provide any assurance that the code compile fines, because some static checking is performed after type-checking (in my case a "this kind of expression is not allowed in a let rec..."). So to be sure that I get all statically-detected errors, I have to use `ocamlc -c` which is less informative. It would be nice if `ocamlc -i -c` gave me the best of both worlds, while it currently ignores the `-c` part.
frisch (developer)
2012-03-14 08:47

In addition to performing type-checking, "-i" also prints the inferred interface. Maybe we should introduce a new "type-check only" flag, which does the full type-checking (and produce .annot files if requested), without printing the interface.
xleroy (administrator)
2012-03-26 15:09

Several OCaml developers are discussing this PR right now, and we're not sure what usage scenario you have in mind. Why is it that you can't use "ocamlc -c -annot" ?
garrigue (manager)
2012-03-27 05:03

I just stumbled on it when trying to look both at the interface generated for a unit and its annotations.
This was for debugging purposes, but this could happen in a developing tool too.
I'm not 100% sure what is the right behavior.
Note that -annot is not linked to compilation: it may output some information even if type checking fails.
gasche (developer)
2012-03-27 10:45

I believe the expected behavior is rather clear: don't ignore any explicitly passed flag, even in presence of -i.
  - if -annot is passed, produce -annot files before printing the interface
  - if -c is passed, then compile (and report related errors) after printing the interface

If there was an additional typecheck-only flag as suggested by Alain, it would be implied by -i and -annot, but would not imply interface printing -- a reasonable rationale for this is that interface printing can be slow.
xleroy (administrator)
2012-03-27 10:52

I am not questioning the expected behavior: I'm questioning the need for yet another flag or combination of flags, given that "ocamlc -i" followed by "ocamlc -c -dannot" does the job in this case.

In the past, -i was a modifier on -c and would not prevent generation of compiled files, and some users made a reasonable point that -i should print the inferred interface *and do nothing else*. Could we just stick with this behavior?
doligez (administrator)
2012-03-27 17:11

I have looked into the code and noticed that "ocamlopt" does allow -i and -annot together.
Moreover, "ocamlc -i" also fails to check for warnings-as-errors and to remove preprocessed temporary files.

I have brought ocamlc in line with ocamlopt on all these points.

Until the next release, you can work around this issue by using "ocamlopt -i -annot".

Fixed in 4.00 (commit 12284) and trunk (commit 12285).

- Issue History
Date Modified Username Field Change
2012-03-14 02:24 garrigue New Issue
2012-03-14 06:27 gasche Note Added: 0007062
2012-03-14 08:47 frisch Note Added: 0007064
2012-03-26 15:09 xleroy Note Added: 0007165
2012-03-26 15:09 xleroy Status new => feedback
2012-03-27 05:03 garrigue Note Added: 0007178
2012-03-27 05:03 garrigue Status feedback => new
2012-03-27 10:45 gasche Note Added: 0007190
2012-03-27 10:52 xleroy Note Added: 0007192
2012-03-27 10:52 xleroy Status new => resolved
2012-03-27 10:52 xleroy Resolution open => suspended
2012-03-27 17:11 doligez Note Added: 0007200
2012-03-27 17:11 doligez Status resolved => closed
2012-03-27 17:11 doligez Resolution suspended => fixed
2012-03-27 17:11 doligez Fixed in Version => 4.00.0+dev
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker