caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Goswin von Brederlow <goswin-v-b@web.de>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Warnings opening modules (was: why is building ocaml hard?)
Date: Thu, 14 Jul 2016 11:03:01 +0200	[thread overview]
Message-ID: <20160714090300.GB21053@frosties> (raw)
In-Reply-To: <E51C5B015DBD1348A1D85763337FB6D9011EA042A5@Remus.metastack.local>

On Wed, Jul 13, 2016 at 12:08:30PM +0000, David Allsopp wrote:
> Gerd Stolpmann wrote:
> > Am Sonntag, den 10.07.2016, 12:57 +0100 schrieb David Allsopp:
> > > Gerd Stolpmann wrote:
> > > <snip>
> > > > For example, when there is
> > > >
> > > > open M1
> > > > open M2
> > > >
> > > > at the beginning of a file, ocamldep doesn't know whether M2 is
> > > > another top-level module, or whether it is a submodule of M1.
> > > > ocamldep normally errs on the side of generating too many
> > > > dependencies, which is then tried to be corrected by only accepting
> > > > those deps corresponding to existing files. In this example, this
> > > > would mean that a dependency to M2 is emitted when there is a file
> > > > M2.ml. Note that this is wrong when M2 is actually a submodule of M1
> > > > AND the file M2.ml
> > > exists.
> > >
> > > I hate the open statement (indeed, I hate its equivalent in every
> > > language I've ever used), which limits how much I tend to consider it:
> > > but this is awful in so many ways. Do you happen to know how common it
> > > is to open one module and then open a *unqualified* submodule of that
> > > (i.e. where M2 is a submodule of M1)?
> > 
> > I cannot give numbers, but imagine M2 is actually called Types or Util.
> > This trap is a real one. It is not one that makes the build tools
> > completely unusable, but it adds a litte bit of the unreliability that is
> > observed by the users. If we want to address these issues ocamldep needs
> > to be part of this effort.
> > 
> > Successive opens are quite normal when you have packed libraries.
> 
> Sure, but in which case, isn't encouraging (and eventually mandating)
> 
> open ReallyCoolLibraryPack.Util
> 
> considerably better than:
> 
> open ReallyCoolLibraryPack
> (* myriad more open statements *)
> open Util
> 
> and eventually solves considerably more problems.

How does that change anything? A (for me) more common code would be:

    open ReallyCoolLibraryPack
    (* myriad more open statements *)

    Util.foo bla baz
    module Bla = Util.MAKE(M : FOOABLE)

You still get the same dependency on ReallyCoolLibraryPack.Util,
ReallyCoolLibraryPack.Util.MAKE, ReallyCoolLibraryPack.FOOABLE, ...
without successive opens.

> > > It strikes me that that pattern requires not a new language convention
> > > as you go on to say, but at least two warnings and possibly a
> > > deprecation to discourage its ever being written! The first warning
> > > (including a deprecation message) should state that [open M2] relies
> > > on the previous [open M1] (similar idea as Warning 40) and the second
> > > warning should trigger if M2.cmi also exists indicating that M1.M2 has
> > > been opened rather than the actual M2 module (again, with a
> > > deprecation message). Both warnings being eliminated by giving:
> > >
> > > open M1
> > > open M1.M2
> > >
> > > The big stability nightmare that I see there is you have:
> > >
> > > open ThirdPartyLibrary
> > > open MyOwnProjectModule
> > >
> > > and a new version of ThirdPartyLibrary adds a submodule
> > MyOwnProjectModule.
> > 
> > I think that we need a syntax for toplevel module paths (e.g. I suggested
> > "open ^MyOwnProjectModule", resembling anchored regular expressions).
> 
> Indeed, but rather than adding yet another piece of syntax, does it cause so much pain to move in the direction of just making the open declaration always require a toplevel module path?

It's not just open but every module path anywhere.
 
> David

MfG
	Goswin

  parent reply	other threads:[~2016-07-14  9:03 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-10 11:57 David Allsopp
2016-07-10 19:45 ` Gerd Stolpmann
2016-07-13 12:08   ` David Allsopp
2016-07-13 12:20     ` Gerd Stolpmann
2016-07-13 12:30       ` David Allsopp
2016-07-14  9:03     ` Goswin von Brederlow [this message]
2016-07-15  9:52       ` David Allsopp
2016-07-15 16:13         ` Hendrik Boom
2016-07-15 16:57           ` Yotam Barnoy
2016-07-15 18:09             ` Jeremy Yallop
2016-07-15 18:26               ` Hendrik Boom
2016-07-15 18:58               ` Yotam Barnoy
2016-07-15 19:26                 ` Hezekiah M. Carty
2016-07-15 19:42                   ` Yotam Barnoy
2016-07-15 19:52                     ` Jeremy Yallop
2016-07-15 20:25                       ` Yotam Barnoy
2016-07-15 18:50             ` Alain Frisch
2016-07-15 19:44               ` Hendrik Boom
2016-07-15 17:04           ` Gerd Stolpmann
2016-07-20  7:49             ` Louis Gesbert
2016-07-16  7:40           ` Petter A. Urkedal
2016-07-16  9:58             ` vrotaru.md
2016-07-19 16:37               ` Yotam Barnoy

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=20160714090300.GB21053@frosties \
    --to=goswin-v-b@web.de \
    --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;
as well as URLs for NNTP newsgroup(s).