Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004992OCamlOCaml generalpublic2010-03-04 19:542012-09-25 20:06
Reporterletouzey 
Assigned Toxclerc 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.11.2 
Target VersionFixed in Version3.12.1+dev 
Summary0004992: an ocamldep aware of files with other suffixes than .ml / .mli ?
Description
Hi

In the same spirit as the -intf-suffix of ocamlc/ocamlopt, it would be
nice to have a way to tell ocamldep that the files with some particular
suffix (say, .ml4 or .mlp) are also implementations, in addition to the
usual .ml files.

In the Makefile of Coq, since some macro-generated .ml are not easy to
produce initially out of our .ml4, we use now ocamldep -modules
to get just the unit names of the dependencies, and then use an ad-hoc
wrapper around ocamldep to locate the files (.ml or .ml4) corresponding
to these units. It would be nice to be able to do that directly with
ocamldep

Best regards,

Pierre Letouzey
TagsNo tags attached.
Attached Files

- Relationships
has duplicate 0001609closed ocamldep et suffixes 

-  Notes
(0005731)
xclerc (developer)
2010-12-08 10:29

Could you be more specific about the intended behavior of an "-impl-suffix" flag?

Notice that the "-intf-suffix" flag you are referring to replace the default ".mli"
suffix of interface file with a new suffix, it does not add new suffixes to be treated
in the same way ".mli" is.
From you report, I incline to think you would like to have the latter behavior rather
than former one, but in that case the behavior would not be coherent with the one
of the compilers.

I the meantime, as you may already know, it is possible to overcome the problem
by using the "-impl" and "-intf" flags of "ocamldep".
(0005745)
letouzey (reporter)
2010-12-20 18:29

Hi xavier,

Indeed, being able to allow new possible suffixes (such as ".ml4")
in addition to the default ".ml" would be more interesting than
just replacing ".ml" by something else. I didn't noticed that
the "-intf-suffix" of ocamlc was meaning "forget about .mli and
consider only ...".

The idea is just to enhance a bit the lookup of local modules needed
by foo.ml: if foo.ml mentions Bar, ocamldep foo.ml will mention
bar.cm{o,x} only if bar.ml is found around (same place or via -I).
If bar.ml isn't found, ocamldep doesn't complain and writes no deps,
probably assuming that Bar is somewhere in the stdlib. This feature
wish is about allowing to search for more than just bar.ml, say bar.ml4.
And this bar.ml4 might not be pristine ocaml syntax, normally only
its existence is meaningful here. A more explicit name for this option
would then be something like --add-impl-suffix-to-lookup

Concerning -impl and -intf, to my understanding they are only of limited
help here: ok, they can be used when the whole bunch of files is given
at once to ocamldep, typically to create a unique .depend. But here
we try to rather create one .d dependency file per source file, a bit
like ocamlbuild, hence running multiple instances of ocamldep and giving
them only one file name at a time.

Best regards,

Pierre

PS: something surprised me when doing quick tests about this "-impl".

echo "let x = 1" > a.ml4
echo "let y = A.x" > b.ml
ocamldep -impl a.ml4 b.ml

With my ocaml 3.11.2 here, the output is

a.cmo:
a.cmx:
b.cmo:
b.cmx:

Doesn't that sound like a bug, or am I missing something ?
(0005747)
xclerc (developer)
2010-12-21 09:59
edited on: 2010-12-21 11:27

About your post-scriptum: this is neither a bug, nor you are missing something.
It happens that my workaround suggestion is actually broken: '-impl' says 'process
me as an implementation file', not 'treat me as an implementation while trying to discover
dependencies'.

This reinforces the usefulness of the switch you are requesting.

(0005754)
xclerc (developer)
2011-01-04 12:01

Two command-line options have been added ('-ml-synonym' and '-mli-synonym')
to allow one to define alternative suffixes for implementation and signature files.
Both options should be followed by an extension with a leading dot (e. g.
"-ml-synonym '.ml4'").

- Issue History
Date Modified Username Field Change
2010-03-04 19:54 letouzey New Issue
2010-12-08 10:29 xclerc Note Added: 0005731
2010-12-20 18:29 letouzey Note Added: 0005745
2010-12-21 09:59 xclerc Note Added: 0005747
2010-12-21 11:27 xclerc Note Edited: 0005747
2010-12-21 12:30 xclerc Assigned To => xclerc
2010-12-21 12:30 xclerc Status new => feedback
2011-01-04 12:01 xclerc Note Added: 0005754
2011-01-04 12:01 xclerc Status feedback => resolved
2011-01-04 12:01 xclerc Fixed in Version => 3.12.1+dev
2011-01-04 12:01 xclerc Resolution open => fixed
2011-09-15 13:27 xclerc Relationship added has duplicate 0001609
2012-09-25 20:06 xleroy Status resolved => closed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker