From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id ED7377FF50 for ; Mon, 8 Aug 2016 19:04:17 +0200 (CEST) IronPort-PHdr: 9a23:5cdH8xyGYJYlBb/XCy+O+j09IxM/srCxBDY+r6Qd0ewWIJqq85mqBkHD//Il1AaPBtSDraMcwLOO7+jJYi8p2d65qncMcZhBBVcuqP49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL2PbrnD61zMOABK3bVMzfbWtXN+KxJ3vi6ibwN76W01wnj2zYLd/fl2djD76kY0ou7ZkMbs70RDTo3FFKKx8zGJsIk+PzV6nvp/jtKhY7j9Itvk928lFWKT8N+RkHP0LRAghZmUy49bsqRLrQg6G539aWWITwTRSBA2QwxjwRJb8tmPBvepwwiSAdZn5RLouWDmmqbxgSBLyhT0vODsw8WWRgct12vEI6Cm9rgByltaHKLqeM+BzK/+McA== Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=gabriel.scherer@gmail.com; spf=Pass smtp.mailfrom=gabriel.scherer@gmail.com; spf=None smtp.helo=postmaster@mail-it0-f47.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.214.47; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.214.47 as permitted sender) identity=mailfrom; client-ip=209.85.214.47; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-it0-f47.google.com) identity=helo; client-ip=209.85.214.47; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-it0-f47.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0A4AQBjuqhXhi/WVdFdhBt8B6dDkU6BfSSFeQKBNwc5EwEBAQEBAQEBEQEBAQgLCwkZL4IyBAOCJgEFEhEdARsSBgUBAwwGBQsNAgIJGgMCAiEBAREBBQEKAREZCAoQh3QBAxcOpF6BMj4xizuBaoJbBYZIChknAwpUg1oBAQEBAQEEAQEBARsCBhBxhSmETYJDgkmCNYJaAQSGWgySHzSBYYQ8hjKCO4I5jQqILSGDZoI4Ex6BDyACglWBWToyhhoqgRsBAQE X-IPAS-Result: A0A4AQBjuqhXhi/WVdFdhBt8B6dDkU6BfSSFeQKBNwc5EwEBAQEBAQEBEQEBAQgLCwkZL4IyBAOCJgEFEhEdARsSBgUBAwwGBQsNAgIJGgMCAiEBAREBBQEKAREZCAoQh3QBAxcOpF6BMj4xizuBaoJbBYZIChknAwpUg1oBAQEBAQEEAQEBARsCBhBxhSmETYJDgkmCNYJaAQSGWgySHzSBYYQ8hjKCO4I5jQqILSGDZoI4Ex6BDyACglWBWToyhhoqgRsBAQE X-IronPort-AV: E=Sophos;i="5.28,490,1464645600"; d="scan'208";a="187204398" Received: from mail-it0-f47.google.com ([209.85.214.47]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 08 Aug 2016 19:04:16 +0200 Received: by mail-it0-f47.google.com with SMTP id j124so88205850ith.1 for ; Mon, 08 Aug 2016 10:04:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=jbpqnSGVLw9HcV9kT/A0YRNHIq3zgmPCHPE9Y2rEy9g=; b=G371HO+b9gDBzWDBHIz7mWGNOSRxwIDqoEjNMC+pONu5qCeRNth7m9TlMwvOtfSDNO HZMOJ/r/HGQeYR/tHpWenAYSAEiWBt26uhMZtWj2XHtA+3G9e7vBxKRiNMEMf4tQfVCT aVN1jZ3bp57+Qlmvz4iHVmUOMuMuhwEuyNvntBp+cWxWGq5RcpfVg8jPYone3a+yfS8A aiHdSw+80nvE1mve2cwrROr7MoZplCUZzu1cycxj+jYiKT5dokQRZD3QzgQS1l9ghOsg dmCZp3JjiUy/tqIywi3Nfpyzf+PjBE0J5YcxgXDK3Y0pW48O2ECGHDYU3qHQwA5NMz4+ zp3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=jbpqnSGVLw9HcV9kT/A0YRNHIq3zgmPCHPE9Y2rEy9g=; b=l8ljsnxqK/vgqYqjaQVt6kL4bAuNk+wZ72ettlgVlEbGnhpm/Hu+5PSx/Gg91esmEM 2uhZmhGX6zzcIRkFY104AbT22R/xiop8fSNbIllDac6colCacJmS85XWGhiXpUe2O+kC d//6KV+ykLhL0140KZnmSgqAD3agkM3dsP4Im4SM3YHm/OVaqq9drBUQQ1NDjLKG9xJt PfgK8wUdpjvTEj9yqb7Qp99Npt+Y5tYij1KjM5nHK3iLPPx49ajJIqiUzqFprX85LP6+ JrycZ7eleCa+C48ho9l+MM/ST2AkXUhSefdG5QZq7RfS4XMwYNJrr6AnIA09EWhvjorv /iSg== X-Gm-Message-State: AEkoouvFi56fHGmVmbsA5+4lCRmzsiu9OaaQr9Rgi4yPID/u5S+aweLne0gTw2LAc2WReySa2TH+YBfloLiT4w== X-Received: by 10.36.141.194 with SMTP id w185mr19779069itd.87.1470675855155; Mon, 08 Aug 2016 10:04:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.20.67 with HTTP; Mon, 8 Aug 2016 10:03:34 -0700 (PDT) In-Reply-To: <8737mfp7j3.fsf@gmail.com> References: <8737mfp7j3.fsf@gmail.com> From: Gabriel Scherer Date: Mon, 8 Aug 2016 19:03:34 +0200 Message-ID: To: moosotc@gmail.com Cc: caml users Content-Type: text/plain; charset=UTF-8 Subject: Re: [Caml-list] Interface(.mli) location It is correct that ocamldep assumes that the .ml and .mli of a given module are at the same place, but this is not the case for the rest of the compilation chain, which is either concerned with single source files (a .ml file or a .mli file) or with "compilation units" (a .cmo and .cmi files passed together, independently of where their source files were). In particular, all type-checking tools do look in -I directories to find .cmi files for the dependencies of the module being compiled (and at this stage they do not care for .mli files). On Mon, Aug 8, 2016 at 6:09 PM, wrote: > > It appears that .mli ought to always reside in the same directory > corresponding .ml lives in. Here's a simple shell script to illustrate > (probably a good idea to run inside freshly created temporary > directory): > > #!/bin/sh > set -x > rm -fr a* d > > touch a.ml > ocamldep a.ml > ocamlc -c a.ml || echo no cookie 1 > ls > rm -f a* *.cm* > > touch a.ml a.mli > ocamldep a.ml > ocamlc -c a.ml || echo no cookie 2 && ls > ocamlc -c a.mli && ls > ocamldep a.ml > ocamlc -c a.ml || echo no cookie 3 && ls > rm -f a* > > mkdir -p d > touch a.ml d/a.mli > ocamldep -I d a.ml > ocamlc -I d -c a.ml > ls > > Transcript: > + rm -fr 'a*' d > + touch a.ml > + ocamldep a.ml > a.cmo : > a.cmx : > + ocamlc -c a.ml > + ls > a.cmi > a.cmo > a.ml > repro.sh > + rm -f a.cmi a.cmo a.ml a.cmi a.cmo > + touch a.ml a.mli > + ocamldep a.ml > a.cmo : a.cmi > a.cmx : a.cmi > + ocamlc -c a.ml > File "a.ml", line 1: > Error: Could not find the .cmi file for interface a.mli. > + echo no cookie 2 > no cookie 2 > + ls > a.ml > a.mli > repro.sh > + ocamlc -c a.mli > + ls > a.cmi > a.ml > a.mli > repro.sh > + ocamldep a.ml > a.cmo : a.cmi > a.cmx : a.cmi > + ocamlc -c a.ml > + ls > a.cmi > a.cmo > a.ml > a.mli > repro.sh > + rm -f a.cmi a.cmo a.ml a.mli > + mkdir -p d > + touch a.ml d/a.mli > + ocamldep -I d a.ml > a.cmo : > a.cmx : > + ocamlc -I d -c a.ml > + ls > a.cmi > a.cmo > a.ml > d > repro.sh > > In essence: if one needs a variant build with some module providing the > same interface but different implementations (in different directories) > ocaml(c|opt|dep) will force this person to have the same (stable and > unchanging) .mli in those implementation specific directories. > > Section 2.5 of the manual does not specify the relative file-system > locations of interface/implementation files, but typing/typemod.ml, if I > am reading it correctly, forces specific layout. > > So it would have been nice to either lift this restriction (i.e. have > ocaml[c|opt|dep] look inside -I supplied directories or spell out the > requirements in the documentation. > > -- > mailto:moosotc@gmail.com > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs