Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005777OCamlOCaml generalpublic2012-10-07 14:322013-06-28 17:51
Reportermeyer 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityhave not tried
StatusfeedbackResolutionopen 
PlatformOSOS Version
Product Version4.00.1 
Target VersionFixed in Version 
Summary0005777: Update mode for inferring mli files
DescriptionSome people reported that they want selectively infer signatures for specific entries - value or types by annotating them in some way in the ml file. (e.g 0005764)

I'm proposing completely different solution.

If somebody specifies something like:

ocamlc -infer-update foo.ml

when the mli is not present it will create with all the entries like normally -i would normally print. Otherwise it will re-parse the mli file, compare if the signatures change with some specific rules, and then replace these entries but only with the new ones.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0008369)
Bardou (reporter)
2012-10-30 14:42

What about the following example:

type t = int
let f x = x + 1

interface:

type t
val f: t -> int

I now change implementation as follows:

type t = float
let f x = x +. 1.

The inferred type for f is float -> float. How should the .mli be updated? I would like:

val f: t -> float

But it does not seem easy to decide that we want to keep t.
(0008371)
frisch (developer)
2012-10-30 16:37

I really don't like the idea that the compiler would parse some source file, modify it, and save it back. I've nothing against an external tool trying to do it properly (preserving the formatting and comments of the original file), but I don't think this is robust enough for a compiler and that we should encourage this workflow.
(0008375)
hongboz (developer)
2012-10-31 02:42

frisch, I agree with you, how about my proposal?
(0008379)
frisch (developer)
2012-10-31 17:24

> how about my proposal?

Do you mean the "private" syntax proposed in 0005764?

I don't have a strong opinion on the subject. For me, having to write the .mli file is not a problem. But it makes sense to have a way to define a structure item for the rest of the module but hide it automatically from the resulting signature.

- Issue History
Date Modified Username Field Change
2012-10-07 14:32 meyer New Issue
2012-10-07 14:34 meyer Description Updated View Revisions
2012-10-08 02:29 meyer Description Updated View Revisions
2012-10-30 14:42 Bardou Note Added: 0008369
2012-10-30 16:37 frisch Note Added: 0008371
2012-10-31 02:42 hongboz Note Added: 0008375
2012-10-31 17:24 frisch Note Added: 0008379
2013-06-28 17:51 doligez Status new => feedback


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker