Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Gerd Stolpmann <info@gerd-stolpmann.de>
To: Remco Vermeulen <r.vermeulen@vu.nl>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] ocamldep & compilation units
Date: Fri, 02 Jan 2015 19:11:38 +0100	[thread overview]
Message-ID: <1420222298.12521.72.camel@e130.lan.sumadev.de> (raw)
In-Reply-To: <1088B954-0D62-47D9-B727-2ADE38DD3949@vu.nl>

[-- Attachment #1: Type: text/plain, Size: 1712 bytes --]

Am Freitag, den 02.01.2015, 15:03 +0100 schrieb Remco Vermeulen:
> So my question is. is BAR in the above example correctly identified as a compilation unit by ocamldep?

The syntax doesn't allow an unambiguous identification, so ocamldep
needs to take into account that BAR is a compilation unit. It doesn't
follow "open" when doing this, and I guess this is the point that
confuses you.

The problem is that "ocamldep -modules" by definition can only analyze a
single module. The output is imprecise, however, and possible
inter-module effects are not taken into account (among other things). A
precise output would list BAR with the exception that it might be
shadowed by Foo.

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?).

The workaround is to use naming schemes that allow you to clearly
distinguish between local modules and compilation unit (e.g. all your
local modules have 1-3 characters, and all compilation units have longer
names).

Gerd
-- 
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany    gerd@gerd-stolpmann.de
My OCaml site:          http://www.camlcity.org
Contact details:        http://www.camlcity.org/contact.html
Company homepage:       http://www.gerd-stolpmann.de
------------------------------------------------------------


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2015-01-02 18:11 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 [this message]
2015-01-03 10:52   ` Remco Vermeulen
2015-01-03 11:32     ` Gabriel Scherer
2015-01-03 18:18 ` Xavier Leroy

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=1420222298.12521.72.camel@e130.lan.sumadev.de \
    --to=info@gerd-stolpmann.de \
    --cc=caml-list@inria.fr \
    --cc=r.vermeulen@vu.nl \
    /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