Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Nicolas Pouillard <nicolas.pouillard@inria.fr>
Cc: autoconf@gnu.org, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] managing ocaml dependencies
Date: Fri, 17 Nov 2006 11:36:15 +1100	[thread overview]
Message-ID: <1163723775.26157.87.camel@rosella.wigram> (raw)
In-Reply-To: <cd67f63a0611161343m612d410re129617ded99ec6a@mail.gmail.com>

On Thu, 2006-11-16 at 22:43 +0100, Nicolas Pouillard wrote:
> On 11/16/06, skaller <skaller@users.sourceforge.net> wrote:

> When order of initialization matters, just enforce it.

> > For example:
> >
> > (* file 1 *)
> > let a : int opt = ref None
> > ;;
> >
> > (* file 2 *)
> > let _ = a := Some 99
> > ;;
> >
> > (* file 3 *)
> 
> Just add something like:
> 
> open File2;; (* because initialization order matters *)

Really there should be a directive such as:

require File2;;

or something, implied by 'open', and *mandatory* so that

List.fold_left

without a 

require/open List;;

was an error. In any case, using make for this kind of
job is a real negative for Ocaml. Felix compiles
dependencies recursively and conditionally. It makes
using it -- and upgrading it -- a breeze, and eliminates
the need for external tool support.

Hmm. It would be interesting to write a driver harness
that did this. The biggest impediment is the lack of
an enforced 'require' directive, and the existence
of Ocamlp4, both of which make it hard to use simple
analysis tools to calculate dependencies.

BTW: in the Felix compiler itself the initialisation
order problem arises with the 'version' record:
whenever any code changes, the time stamp in the
version record is updated. The version record
is first in the link order, so any part of the code
can refer to it .. but the actual time stamp is
last in link order to avoid gratuitous recompilations.
Its module uses the above trick -- the time stamp
is stored into the version record by executable 
initialisation code dynamically before any
functions are called in the mainline. This implies
that no modules refer to the version record dynamically in 
initialisations (except the mainline).

This is nasty because this version record is
Marshalled out into pre-compiled Felix code,
and is actually then used for the dependency
checking in Felix -- if the compiler version
changes the Felix sources need to be recompiled.

So there is a 'exponential' dependency situation, where
getting the order right is critical,
hard to enforce, and hard to detect when there
is an error.

Skallers Law: if a programmer can make a mistake ..
skaller will make it.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


  reply	other threads:[~2006-11-17  0:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-16 14:20 Guillaume Rousse
2006-11-16 16:47 ` [Caml-list] " skaller
2006-11-16 19:01   ` Jean-Christophe Filliatre
2006-11-16 21:43   ` Nicolas Pouillard
2006-11-17  0:36     ` skaller [this message]
2006-11-16 21:21 ` Ralf Wildenhues

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=1163723775.26157.87.camel@rosella.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=autoconf@gnu.org \
    --cc=caml-list@yquem.inria.fr \
    --cc=nicolas.pouillard@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