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 ESMTPS id F15ED5D4 for ; Fri, 6 Mar 2020 16:07:18 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.70,522,1574118000"; d="scan'208";a="439201627" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 06 Mar 2020 17:07:16 +0100 Received: by sympa.inria.fr (Postfix, from userid 20132) id BE53D7F44C; Fri, 6 Mar 2020 17:07:16 +0100 (CET) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id BA6AE7F3EC for ; Fri, 6 Mar 2020 17:07:09 +0100 (CET) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jan@besport.com; spf=None smtp.mailfrom=SRS0=5+Xt=4X=besport.com=jan@masterlogin.de; spf=None smtp.helo=postmaster@mxwww.masterlogin.de IronPort-PHdr: =?us-ascii?q?9a23=3AFtjYIB8INuofdP9uRHKM819IXTAuvvDOBiVQ1KB4?= =?us-ascii?q?1egcTK2v8tzYMVDF4r011RmVBNmdsqsewLqI+4nbGkU+or+5+EgYd5JNUxJXwe?= =?us-ascii?q?43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRp?= =?us-ascii?q?OOv1BpTSj8Oq3Oyu5pHfeQpFiCeybL9oMRm6sBvdusYVjIZjN6081gbHrnxUdu?= =?us-ascii?q?tZwm9lOUidlAvm6Meq+55j/SVQu/Y/+MNFTK73Yac2Q6FGATo/K2w669HluhfF?= =?us-ascii?q?TQuU+3sTSX4WnQZSAwjE9x71QJH8uTbnu+Vn2SmaOcr2Ta0oWTmn8qxmRgPkhD?= =?us-ascii?q?sBOjUk9mzcl85+g79BoB+5uRJxw5PaboKbOvVwcazSYdwUSHFdXstTTSFNHp+w?= =?us-ascii?q?YoUNAucHIO1Wr5P9p1wLrRamAQejHuXvwSJUiH/xwaI60/ouEQXb1wEnHdIBqn?= =?us-ascii?q?LUoc7uO6gMSuC11K7IzS/fb/9MxTj9743IfwknrPqRXrxwadLcxE0vGg/fk1mc?= =?us-ascii?q?t4joMymV2+gQqWSX8fRsWf63h2Mjtg19uCWjy8cxhoXThI8YxUrI+Cd9zYszON?= =?us-ascii?q?a2UlR0YcS+H5tVryyaN5V5QsclQ2xwvSY7xbMHuJC1fSQQzZQo3QXfa+CZfIiS?= =?us-ascii?q?5hLjU+mRITZ+hH5/Zb2wmQ6+8UmmyuLiSsm5yFJHoypfntXRqHwA0wbf58iaRv?= =?us-ascii?q?dn4EutxyqD2xjW6u5eIEA0kaTbK4Qmwr41jpcdrFjNEDLqlEjujKKacUQr+vSw?= =?us-ascii?q?5unoY7rrvoSTOJFvigHmNaQugNC/Df4kPQgJWmiW4ea826fl/UDiRbVFlOY2kr?= =?us-ascii?q?XHv5DAIcQboaG5Aw5T0oo59hmwES+q0M4EknkfMFJFZBWHgpD1NF7UJfD4Ce6z?= =?us-ascii?q?g1CtkDdw2/DLJabhA5XILnjbirjtZ7d960hGyAoy199T/ZxUCqtSaM70D0T4sd?= =?us-ascii?q?idCh4iLyS1xfzmAZNzzNAwQ2WKV42QNuvotlSI6+Znd+uFYqcftS3lLOI5ofXp?= =?us-ascii?q?iClqyhcmYaC10M5POziDFfN8LhDBOCe+spI6CW4P+zEGYqnqhVmFC2QBYmatQL?= =?us-ascii?q?164zggFI+8CYDMR4brjLHThH7qTK0TXXhPDxW3KVmtcoyFX/kWbyfLfJ1kmycY?= =?us-ascii?q?WKKlTIAg01eiuV2ikuY1Hq/v4iQd8Knb+p1t/eSKzkM4+CdsCN6BlWqKSjMskw?= =?us-ascii?q?=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CPCQDGdGJeh9wzgV9lHQEBAQkBEQUFA?= =?us-ascii?q?YF7gxhSAQEwhD+PAIFshBOXWQEDAQwvBAEBhFCCAxwGBjQTAhABAQUBAQECAQI?= =?us-ascii?q?DBAETAQEBCgsJCBsOhWmCOyKDMASBBwImAmwIAQGDIoMAAakBfzOIdIE+gQ4qj?= =?us-ascii?q?CgaggCBOAyCNAGGAoJEgjwiBJdgmEGCRgR4jCOJQQYcjwwFjCSqb4FpgXpNIxW?= =?us-ascii?q?DKGcNnGZAAQGRKAEB?= X-IPAS-Result: =?us-ascii?q?A0CPCQDGdGJeh9wzgV9lHQEBAQkBEQUFAYF7gxhSAQEwhD+?= =?us-ascii?q?PAIFshBOXWQEDAQwvBAEBhFCCAxwGBjQTAhABAQUBAQECAQIDBAETAQEBCgsJC?= =?us-ascii?q?BsOhWmCOyKDMASBBwImAmwIAQGDIoMAAakBfzOIdIE+gQ4qjCgaggCBOAyCNAG?= =?us-ascii?q?GAoJEgjwiBJdgmEGCRgR4jCOJQQYcjwwFjCSqb4FpgXpNIxWDKGcNnGZAAQGRK?= =?us-ascii?q?AEB?= X-IronPort-AV: E=Sophos;i="5.70,522,1574118000"; d="scan'208";a="439201508" X-MGA-submission: =?us-ascii?q?MDHQ1EwuoDKUTnGCfO6iEATCPd7/4gUjzq1BEd?= =?us-ascii?q?rUigCB6Ov1ahGATFTwXdmsn09+85dyk9xmWRSLqz9ug0Yx6laXaVQYa1?= =?us-ascii?q?/u4auSlUSPtIWSx5d9XMTf6uXYO6SU6BQjXbhqBo1ujSwfUsaAiDaNIu?= =?us-ascii?q?JXZ/uodKcPg7PrwAiI6iFAiw=3D=3D?= Received: from mxwww.masterlogin.de ([95.129.51.220]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2020 17:06:47 +0100 Received: from mxout1.routing.net (unknown [192.168.10.81]) by forward.mxwww.masterlogin.de (Postfix) with ESMTPS id F23A496074 for ; Fri, 6 Mar 2020 16:06:45 +0000 (UTC) Received: from mxbox2.masterlogin.de (unknown [192.168.10.89]) by mxout1.routing.net (Postfix) with ESMTP id D4EF7401E4 for ; Fri, 6 Mar 2020 16:06:45 +0000 (UTC) Received: from [192.168.102.102] (unknown [91.151.74.79]) by mxbox2.masterlogin.de (Postfix) with ESMTPSA id 670DC1006FE for ; Fri, 6 Mar 2020 16:06:45 +0000 (UTC) To: caml-list@inria.fr From: Jan Rochel Autocrypt: addr=jan@besport.com; prefer-encrypt=mutual; keydata= mQGiBE9nYn4RBADcO7KUrEcri6JN4TllnZ+2IPOTToilRFFShOmkqaZSeIq8VaPeodC46Shu lqQCc0Jop+7Xv1bumlXvIvHC7ckB5CAeZgEdZJ1F81hdtWck4rAHIGQ9Tv87YvNwqTGzy5wy xStmYjuzh2y6l4Ev1UoKSKgGawozF1gAnVO+bZvwMwCg0A5ZuIJ8UmphEtPStqcs+R/hWcEE AKrc8h5R44vSCcNEp5n0sbpjzPwLEUIJ2BeKQ7NVbQhW5r54DqLtVTl1b5mXNciggzj5W1UN vT0WvtYg/ePedHRwOdaANlXgYypnhfQI8RqYGunthRWasFnmlA8JVvKotrUpYoHLmghl0y4X gyX7Njt4pPOLk/za1zL8MABu8Ub7A/9B+KA7+B/gvj9BmbmMS4+A5C6SDu1U47Dh825zs0Ac XctRwFhhH6ukeTcZctIJhwTnptwBWjr/ySGg0EghuZ9uzi+bXtes8/Fj7OrqOh8vzoGVaILS 9zNb2ohkTzhCZmZ0RIzTSXsadWn3rS1y2xXFuS6C59Tz/e2OraT1xp/UxLQcSmFuIFJvY2hl bCA8amFuQHJvY2hlbC5pbmZvPohiBBMRAgAiBQJPZ2J+AhsDBgsJCAcDAgYVCAIJCgsEFgID AQIeAQIXgAAKCRDxjBKBYbjKKXyuAJkBAJoZyKipH49sfD06WISQyY5owwCgvh77FLBdmwVX tcvz2rqvYQasuoq5AQ0ET2difhAEAOhpVlfqcWoNp92a0IteD5PXrvLLhX4xkNjcNYyconno Gt2dtEMjaB8P7gcFwfwmykl0n9sUdCNyNbaqX13BE8MhmzvtCzburwbeifaBZ9R3ywYciDMN vLiSU2dib8F2dnYj7JmYY0564XBppZ/Jp9of7Kb2pZYpFSQ4JtyvSeNbAAMFA/4/0Z02Wvud dqkGUZ8CfPPGgKevhH1M9jmuY2n1Vcx7lxnAWo1sfKosRa75M6oXvxyvArY7+WrJh/d5voTM oJYB1U4ZaJqKwwZXYlHkYt6zQ/TQwiK1gboY+Txu/jeYo5iiHQHl2c1k+Wwkh8xOshTH1Hg/ KjM3/2baEJs6axCshIhJBBgRAgAJBQJPZ2J+AhsMAAoJEPGMEoFhuMopAE0An0b7+O/z7vWD cNj12jPREdoS+re7AKDI+WeIITy8Eb0fxbQ/ibWmojcsKA== Message-ID: <5ceb9ffd-943b-b1f2-4851-e4bf528a791d@rochel.info> Date: Fri, 6 Mar 2020 17:06:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: [Caml-list] Mutually recursive dependent files Reply-To: Jan Rochel X-Loop: caml-list@inria.fr X-Sequence: 18046 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'm sure that most of you have tripped at one point or another over the problem of OCaml not allowing for module files that mutually depend on each other. The fact that this is possible for modules within the same file raises the question: why not for module files? If I had to guess I'd say that the following reasoning led to that limitation: OCaml's semantics is script-like in that there is not a specific, explicitly defined entry point (such as a main-function in C), but each file is interpreted from top to bottom, so the order of the declarations within a file is critically important (due to side effects they may have). This also pertains to the order imposed on the module files before compilation and linking. (This order is either imposed by the user or a dependency generator). Now if one were to allow for recursive module files, then there would be no well-defined linear order imposable on them and therefore the semantics would become ambiguous. My first question: Is this the actual reasoning behind the limitation or are there other (perhaps more pertinent) reasons? My contention: The above-mentioned ambiguity already exists if a dependency generator is used. If we have modules A -> B <- C, then there are two orders possible: BAC and BCA. A and C may both produce side-effects within B during "initialisation" and unexpected things might happen in B. Given this fact, it should already be considered bad practice to write OCaml programs that are sensitive to module linking order. But if OCaml programs already have to be written with this semantic ambiguity in mind, then why not simply allow for mutually recursive module files? My second question: If the answer to my first question is yes, and if my contention is to the point, then I'd be curious to to know how difficult it would be to add a flag to the OCaml compiler allowing for mutually recursive dependencies? Jan