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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id E35EA7FE44 for ; Sat, 9 Jul 2016 18:16:07 +0200 (CEST) IronPort-PHdr: 9a23:IRUKnxIgdZRHLZZzktmcpTZWNBhigK39O0sv0rFitYgUIvXxwZ3uMQTl6Ol3ixeRBMOAuqoC0LGd4vuocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXsq3G/pQQfBg/4fVIsYL+kQsiJ1I/mjKibwN76W01wnj2zYLd/fl2djD76kY0ou7ZkMbs70RDTo3FFKKx8zGJsIk+PzV6nvp/jtLYqySlbuuog+shcSu26Ov1gFf0LRAghZioO48DkqQPEVU/Hw3oXUmwbllAAVw3E5xHzU5O3qSz3ufZn3zGyPMvqQLRyUjOnufRFUhjt3W0/OiIl/Xufo4o4sbhYrR6oo1Y3l5bdfZuWOfZ3eovSeNobQSxKWcMHBH8JOZ+1c4ZaV7lJBu1ftYSo4gJW9RY= Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=paurkedal@gmail.com; spf=Pass smtp.mailfrom=paurkedal@gmail.com; spf=None smtp.helo=postmaster@mail-oi0-f54.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of paurkedal@gmail.com) identity=pra; client-ip=209.85.218.54; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="paurkedal@gmail.com"; x-sender="paurkedal@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of paurkedal@gmail.com designates 209.85.218.54 as permitted sender) identity=mailfrom; client-ip=209.85.218.54; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="paurkedal@gmail.com"; x-sender="paurkedal@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-oi0-f54.google.com) identity=helo; client-ip=209.85.218.54; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="paurkedal@gmail.com"; x-sender="postmaster@mail-oi0-f54.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0A5AABcIoFXhjbaVdFchBR8BqYNh0+LOIF6GoJHgzcCgRwHOBQBAQEBAQEBAREBAQEICwsJIS+CMgQBEgGCEwEFEhEEGQEIEx0BAwwGBQsNAgImAgIiAREBBQEcBhMih3MBAxehQYExPjGLO4FqgloFhTkKGScNUoNJAQEBAQEFAQEBARsCBhBxiXOEQYMBgloBBJkYAYYMiEWCOIx0jlASHoEPHoJQgVk6Mol6AQEB X-IPAS-Result: A0A5AABcIoFXhjbaVdFchBR8BqYNh0+LOIF6GoJHgzcCgRwHOBQBAQEBAQEBAREBAQEICwsJIS+CMgQBEgGCEwEFEhEEGQEIEx0BAwwGBQsNAgImAgIiAREBBQEcBhMih3MBAxehQYExPjGLO4FqgloFhTkKGScNUoNJAQEBAQEFAQEBARsCBhBxiXOEQYMBgloBBJkYAYYMiEWCOIx0jlASHoEPHoJQgVk6Mol6AQEB X-IronPort-AV: E=Sophos;i="5.28,337,1464645600"; d="scan'208";a="226179012" Received: from mail-oi0-f54.google.com ([209.85.218.54]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 09 Jul 2016 18:16:07 +0200 Received: by mail-oi0-f54.google.com with SMTP id u201so97193348oie.0 for ; Sat, 09 Jul 2016 09:16:07 -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:content-transfer-encoding; bh=8XW8Vxhh942XDwqtkbVgeK9i2xgae/XN8jlo+bpZM5M=; b=YBj7jfeDE4jKdpZ/yjf5ieQpInGXdvU1yclBlG+ET655I04fSidrVss9p2h5vJq6nD wbNIOa/ez1Pcl91f6I/FaKAu0a4GRqyyoiCSYTe2I/glD8oo3feNEG5DImubkXOwgLS2 Nfgxjbk4qO2DqhB2Ep+UQ7TV9JW+BwPDKDlRW5ist2PYhXVrE/hdTJRkUj5cmT7cUoRc 5lL8h8heLZywHtaEsi6XIeIbF3gchQu52sDmNMy0PvhkfMUNqctsXLHMPQOoUzFh3fUV TYcPs2CR5+Y3aTTY/5Cunicp9PF7UTMFu22lnLsj8EKG4RFUi2Gya4YB1HCSnSYlcepp sizA== 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:content-transfer-encoding; bh=8XW8Vxhh942XDwqtkbVgeK9i2xgae/XN8jlo+bpZM5M=; b=e9r4j1Xl76/F2e8oBVqvsKgI6e9ICuecNNgZ63z11y/BYgLO7U+F9/fd6PqaHaRloj eA1I9y+uunmYrWrONRTubsTS3aztwd3BGPOjsH3IaL3Zc0KrWFf1lrBkQLU3cqt+Mlpf jrzyVwiEMJaAGOF8g8fvbpc8Bo74Oef77vEdDVmtU1w8hRv416oQ1iks4o7XLknrbJls /gJyPza4swTFvYXXUW08Gr9AN56dqHBXSq+yDosyXHUL9ju1tDFcczyto2BzxWBpKiLs 530h82r+pxENTKHrhXR2iYSHdGTisLKTr6iMC1NcHxuqii5nkLfxRxWRa87boNLvph7B jewg== X-Gm-Message-State: ALyK8tLgyiboGmm+tL2ibEjOtNz49GvfxSRlZGrudrDX5ZCl4A9Iwny3o+KtqaVjPrKCN1L/hUdrw7p+SFgfsw== X-Received: by 10.202.63.86 with SMTP id m83mr5743864oia.139.1468080964455; Sat, 09 Jul 2016 09:16:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.202.228.201 with HTTP; Sat, 9 Jul 2016 09:16:03 -0700 (PDT) In-Reply-To: <0F7D3B1B3C4B894D824F5B822E3E5A172CF20547@IRSMSX102.ger.corp.intel.com> References: <0F7D3B1B3C4B894D824F5B822E3E5A172CF204AF@IRSMSX102.ger.corp.intel.com> <0F7D3B1B3C4B894D824F5B822E3E5A172CF20547@IRSMSX102.ger.corp.intel.com> From: "Petter A. Urkedal" Date: Sat, 9 Jul 2016 18:16:03 +0200 Message-ID: To: "Soegtrop, Michael" Cc: Gabriel Scherer , "caml-list@inria.fr" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] ocambuild vs ocamldep circular dependencies There is a way to do it if I understood the problem right by functorizing and linking explicitly with the `module rec` construct: $ cat first_sig.mli module type S =3D sig type a type b val null : unit -> a val succ : b -> a end $ cat second_sig.mli module type S =3D sig type a type b val null : b val succ : a -> b end $ cat first.ml module Make (X : Second_sig.S) =3D struct type b =3D X.b type a =3D N | B of b let null () =3D N let succ x =3D B x end $ cat second.ml module Make (X : First_sig.S) =3D struct type a =3D X.a type b =3D N | A of a let null =3D N let succ x =3D A x end $ cat both.ml module rec A : First_sig.S with type b =3D B.b =3D First.Make (B) and B : Second_sig.S with type a =3D A.a =3D Second.Make (A) There are typically some shared types at the top of the signatures, which could be put into a separate file and included. On 9 July 2016 at 17:16, Soegtrop, Michael wro= te: > Dear Gabriel, > > > > The current implementation happens to allow them, but this does not mean > that they are "valid programs". > > I see what you mean: since I can=E2=80=99t put both modules into a single= file > without changing the two let into let rec / and or using recursive module= s, > it is not valid OCaml, although the compiler accepts it if presented > separately. > > > > Let me see what I can do here. The mutual dependent part is a large part = of > both modules so it wouldn=E2=80=99t be very nice to put them into one fil= e. But if > it is the only option to get a valid OCaml program, I will look into it. > > > > Still I think it is unfortunate that OCaml doesn=E2=80=99t support this. = It makes it > harder to structure software in an aspect oriented way. For simple data > structures it is fine to bundle all aspects into a single module or file. > For a data structure like a C AST, the module / file will get quite large= . I > can separate off the statements easily, but this is only a small part of = the > AST. The largest part are expressions and types, and these are recursively > dependent on each other. > > > > Best regards, > > > > Michael > > Intel Deutschland GmbH > Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany > Tel: +49 89 99 8853-0, www.intel.de > Managing Directors: Christin Eisenschmid, Christian Lamprechter > Chairperson of the Supervisory Board: Nicole Lau > Registered Office: Munich > Commercial Register: Amtsgericht Muenchen HRB 186928