Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Xavier Leroy <Xavier.Leroy@inria.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] ocamldep & compilation units
Date: Sat, 03 Jan 2015 19:18:54 +0100	[thread overview]
Message-ID: <54A8328E.5020109@inria.fr> (raw)
In-Reply-To: <1088B954-0D62-47D9-B727-2ADE38DD3949@vu.nl>

On 02/01/15 15:03, Remco Vermeulen wrote:
> baz.ml:
> 	open Foo
> 	...
> 	BAR.x ()
>         …
> 	Bar.y ()
> 
> ocamldep -modules baz.ml, as used by Omake, returns baz.ml: BAR bar.

To add to the useful answers already given, another way to work around
this issue is to use explicit qualification for BAR:

 	open Foo
 	...
 	Foo.BAR.x ()
         …
 	Bar.y ()

That will prevent ocamldep from mistaking BAR for a compilation unit.

Gerd Stolpmann adds:

> But imagine now we had the information with this degree of detail. As
> omake wants to figure out the dependencies it would have to solve a
> puzzle. In your case it is easily to solve, but in practice there are
> often several "open" directives, and in this case you don't even know
> whether "open Foo" opens a compilation unit. I am not sure whether a
> well-performing algorithm even exists (did anybody tackle this
> problem?).

Matthias Blume showed a NP-completeness result for a closely-related problem:

Matthias Blume: Dependency analysis for Standard ML. ACM
Trans. Program. Lang. Syst. 21(4): 790-812 (1999)

- Xavier Leroy

      parent reply	other threads:[~2015-01-03 18:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-02 14:03 Remco Vermeulen
2015-01-02 18:11 ` Gerd Stolpmann
2015-01-03 10:52   ` Remco Vermeulen
2015-01-03 11:32     ` Gabriel Scherer
2015-01-03 18:18 ` Xavier Leroy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54A8328E.5020109@inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox