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 278C45D4 for ; Fri, 11 Oct 2019 15:40:20 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.67,284,1566856800"; d="scan'208";a="405805545" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 11 Oct 2019 17:40:19 +0200 Received: by sympa.inria.fr (Postfix, from userid 20132) id 179F67F2F5; Fri, 11 Oct 2019 17:40:19 +0200 (CEST) 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 E38B37F214 for ; Fri, 11 Oct 2019 17:40:08 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.67,284,1566856800"; d="scan'208";a="322437301" X-MGA-submission: =?us-ascii?q?MDHbm99s85iu11iKzKIy+qduJ3NaRzHnHlHbmo?= =?us-ascii?q?fXGcAaOMqghLT+xpV8Avu23wkIOR4sW3mf8GMyjLEGcDC9rQ7wBUfFLj?= =?us-ascii?q?op9AcfaRq4WVOO4PaQdgC6mQBQlR6IVzpkSQKEAaLbkrazUubz9PjEZw?= =?us-ascii?q?dYkl6byW8V3kgD9NoIrukpIg=3D=3D?= Received: from zcs-store6.inria.fr ([128.93.142.33]) by mail3-relais-sop.national.inria.fr with ESMTP; 11 Oct 2019 17:40:08 +0200 Date: Fri, 11 Oct 2019 17:40:06 +0200 (CEST) From: Thierry Martinez To: Vadim Cc: caml-list Message-ID: <1296445821.9982847.1570808406866.JavaMail.zimbra@inria.fr> In-Reply-To: <0634cce4-0468-c10e-30c8-8e8e7ec937d7@radovel.ru> References: <0634cce4-0468-c10e-30c8-8e8e7ec937d7@radovel.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Originating-IP: [128.93.83.75] X-Mailer: Zimbra 8.7.11_GA_3800 (ZimbraWebClient - FF69 (Linux)/8.7.11_GA_3800) Thread-Topic: How to shadow nested submodules? Thread-Index: 3DPj3Al8sC5m+ICvSECP6aZYsnOvCg== Subject: Re: [Caml-list] How to shadow nested submodules? Reply-To: Thierry Martinez X-Loop: caml-list@inria.fr X-Sequence: 17843 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: Hello, Vadim! Vadim: > Hello! I'm trying to figure out how shadow/override nested modules in > OCaml. A generic solution for old OCaml versions (<4.08) has been explained by Gabriel Scherer in the following blog post: http://gallium.inria.fr/blog/overriding-submodules/ The idea is to use destructive substitution while including the original Ipaddr: http://caml.inria.fr/pub/docs/manual-ocaml-4.01/extn.html#sec234 module Ipaddr = struct include (Ipaddr : module type of Ipaddr with module Prefix := Ipaddr.Prefix) ... end But I guess that the code you posted should work just fine with OCaml >=4.08 thanks to the following change: https://github.com/ocaml/ocaml/pull/1892 Best regards. -- Thierry Martinez.