From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by c5ff346549e7 (Postfix) with ESMTP id B688F5D4 for ; Sat, 29 Feb 2020 08:53:30 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.70,499,1574118000"; d="scan'208";a="438141495" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 29 Feb 2020 09:53:29 +0100 Received: by sympa.inria.fr (Postfix, from userid 20132) id 6EF6C7F444; Sat, 29 Feb 2020 09:53:29 +0100 (CET) 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 297A77F3B1 for ; Sat, 29 Feb 2020 09:53:20 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=rich@annexia.org; spf=Pass smtp.mailfrom=rich@annexia.org; spf=None smtp.helo=postmaster@mail.annexia.org IronPort-PHdr: =?us-ascii?q?9a23=3AOBBCyhXfgcbpDGcHWjjfPHX/HwLV8LGtZVwlr6E/?= =?us-ascii?q?grcLSJyIuqrYYxKEt8tkgFKBZ4jH8fUM07OQ7/m8Hz1Rqs/b6DgrS99laVwssY?= =?us-ascii?q?0uhQsuAcqIWwXQDcXBSGgEJvlET0Jv5HqhMEJYS47UblzWpWCuv3ZJQk2sfQV6?= =?us-ascii?q?Kf7oFYHMks+5y/69+4HJYwVPmTGxfa5+IA+5oAnMucQam49vJ6I+xhfUvHdEZ/?= =?us-ascii?q?ldyH91K16Ugxvz6cC88YJ5/S9Nofwh7clAUav7f6Q8U7NVCSktPn426sP2qxTN?= =?us-ascii?q?VBOD6XQAXGoYlBpIGBXF4wrhXpjtqCv6t/Fy1zecMMbrUL07QzWi76NsSB/1lC?= =?us-ascii?q?cKMiMy/W/LhsBsiq9QvRSsrAF9zYHJeoGYLPRwcKPDc90HRmROUdpeWDFPDY6n?= =?us-ascii?q?c4sDE/AMMfpEo4TnuVcDqwa1Cwm2BOPozz9FnnH607E70+s9EQHJxhYgEM8Tu3?= =?us-ascii?q?vUttn7M70eWv2xwqnPyzXMcehW1Tng44XPaBAhoO2DXbJrfMXLz0kvER3Kj1qR?= =?us-ascii?q?qYP/JT+V0f4Ns2eC4udmSOmhhWknqwRrrTiuwMchkobJhoMJylDE6CV225w5Ks?= =?us-ascii?q?G/SE5+edKkEZ1QtzubN4RsWM8iTXtotSAnwbMFoZ62ZCsHxIk9yxLCaPGKcZKE?= =?us-ascii?q?7xHtWeqLPzt1im5pdbSijBio60eg0PfzVsys3VZKsCVFlt7Mu2gI1xPJ68iHTu?= =?us-ascii?q?Fx8V2n2TaJyQ/S5eBELloumarcMZ4hzaY8lpsVsUvdAi/7gEb7gLKMekk5+eWl?= =?us-ascii?q?6f7rb7boq5OGKYN5hB3yPrwrmsOlAOQ4NgYOX3Kc+eS5zLDj50z5T6lKjvAtiK?= =?us-ascii?q?bZtpbaKtoUp664GQBZyIEj6wywDzu+ytQXgWEHLE5ZeBKAl4XmJ0vBIPX8Dfum?= =?us-ascii?q?h1SskSxrx+zdM736ApTNK2DDn637cbZ87U5c0gszwspF65JaELFSaM70D0T4sd?= =?us-ascii?q?idCh4iLyS1xfzmAZNzzNAwQ2WKV+WjMajSuEWErt1pBq/ERogTtS23Y6w/5vXu?= =?us-ascii?q?pXY/n1INfKDv2oEYPiPrVs96KlmUNCK/yuwKFn0H61JnEL7azWaaWDsWXE6cGr?= =?us-ascii?q?om72hgWougC4rTR4nrh6aOjn/iT89mI1teA1XJKk/GMoCNWvMCciWXe5QzmzoC?= =?us-ascii?q?WKigQskmzx787VanmYoiFfLd/2gjjbym1NVx4LSDxxQ79DgyBsKb3nGMRidzhG?= =?us-ascii?q?xaHzI=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CDDQA9JVpeW+ZTu1FmH4RLJgFFIFUSK?= =?us-ascii?q?o0XhXwBQwoDAwacdQkBAwEMJQoEAQGDe4JOHwcBBDQTAhABAQUBAQECAQIDBAE?= =?us-ascii?q?GGhWFQUwMgjsig0ccXxMhBRgNCoNUglYpC69nhElBhT6BOIw5Bnk+SYFHhgACA?= =?us-ascii?q?oIwgnaCLASwGwcDgjyHUY8IDByDSJdpl2ySdIFpgXp9CIMnCUcYDZIQgT6CYoY?= =?us-ascii?q?1RDACj3ABAQ?= X-IPAS-Result: =?us-ascii?q?A0CDDQA9JVpeW+ZTu1FmH4RLJgFFIFUSKo0XhXwBQwoDAwa?= =?us-ascii?q?cdQkBAwEMJQoEAQGDe4JOHwcBBDQTAhABAQUBAQECAQIDBAEGGhWFQUwMgjsig?= =?us-ascii?q?0ccXxMhBRgNCoNUglYpC69nhElBhT6BOIw5Bnk+SYFHhgACAoIwgnaCLASwGwc?= =?us-ascii?q?DgjyHUY8IDByDSJdpl2ySdIFpgXp9CIMnCUcYDZIQgT6CYoY1RDACj3ABAQ?= X-IronPort-AV: E=Sophos;i="5.70,499,1574118000"; d="scan'208";a="340790228" X-MGA-submission: =?us-ascii?q?MDEJgNLDOyduf/1Wddp9pPmzczVlwb7ery1h3m?= =?us-ascii?q?HiSZPZ7U0qz3iPcU9VCu/KANH3dlVHPSZWWpBJSPUNZ3PraaIBuA+rJh?= =?us-ascii?q?3JMBLhl+zn8obXNGbIuPTGjeeTvMQei+TtmnR/f0u2+uape1QHvWcUzm?= =?us-ascii?q?qFUtspcKrvhqmvUxfyYgBjyg=3D=3D?= Received: from 230.83.187.81.in-addr.arpa (HELO mail.annexia.org) ([81.187.83.230]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Feb 2020 09:53:19 +0100 Received: by mail.annexia.org (Postfix, from userid 1000) id 53D16AC01400; Sat, 29 Feb 2020 08:53:19 +0000 (GMT) Date: Sat, 29 Feb 2020 08:53:19 +0000 From: "Richard W.M. Jones" To: caml-list@inria.fr Message-ID: <20200229085319.GD11122@rich.annexia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Subject: [Caml-list] #use is not textual inclusion Reply-To: "Richard W.M. Jones" X-Loop: caml-list@inria.fr X-Sequence: 18028 Errors-to: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: I was trying to break up a large ocaml interpreted script: https://github.com/libguestfs/libnbd/blob/master/generator/generator The script contains sections like: module Foo : sig (* type signature *) end = struct (* very long implementation *) end and it would be convenient for me to move the implementations into separate files. However this doesn't work: module Foo : sig (* type signature *) end = struct #use "implementation.ml" (* with or without ;; here *) end So I guess #use only works for top level statements, which surprised me and contradicts the documentation here too: https://caml.inria.fr/pub/docs/manual-ocaml/toplevel.html#s%3Atoplevel-directives I could move the whole module definition to the file, but then I would lose the advantage of hiding the implementation while keeping the signature visible in the main file. Given the constraint that we can't use ocamlc or cppo (because of minimal build dependencies), are there any alternatives? My first thought was C's cpp, but it seems impossible to get that working with #!/usr/bin/env and preserve the "scriptiness" of being able to just do ./generator/generator to run it. Rich.