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 07CC97FE44 for ; Wed, 6 Jul 2016 12:15:53 +0200 (CEST) IronPort-PHdr: 9a23:yxVKMxxva9dKugHXCy+O+j09IxM/srCxBDY+r6Qd0eISIJqq85mqBkHD//Il1AaPBtSDragawLOG+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2WVTerzWI4CIIHV2nbEwud7yzQNCZ1pT//tvx0qWbWx9Piju5bOE6BzSNhiKViPMrh5B/IL060BrDrygAUe1XwWR1OQDbxE6ktY+YtaRu+CVIuv8n69UIEeCjJ/x5HvRkC2EENGs44Nzt/SJCVwyTri8+VW4blgtORTPI9hbmdor3szW/vPJ23CSAOMrwUfY6Q2Lxwb1sTUrQhTsbOiRxzXvUh8B5iOoPuBu8vR9yz4fQSI6QPft6OKjaeIVJFiJ6Qs9NWnkZUcuHZIwVAr9EZL4Aog== Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=paurkedal@gmail.com; spf=Pass smtp.mailfrom=paurkedal@gmail.com; spf=None smtp.helo=postmaster@mail-wm0-f49.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of paurkedal@gmail.com) identity=pra; client-ip=74.125.82.49; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="paurkedal@gmail.com"; x-sender="paurkedal@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of paurkedal@gmail.com designates 74.125.82.49 as permitted sender) identity=mailfrom; client-ip=74.125.82.49; receiver=mail3-smtp-sop.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 (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-wm0-f49.google.com) identity=helo; client-ip=74.125.82.49; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="paurkedal@gmail.com"; x-sender="postmaster@mail-wm0-f49.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DjAAD/2XxXhjFSfUpdhRCmQodOhiyFBoF3hhgCgSs6EgEBAQEBAQEBEQEBAQgLCwkhL4IyghsBBRIRDwENARsdAQMMBgUYAgIFEw4CAg8FDxEBBQEiNYdzAQMXBJ4egTE+MYs7gWqCWgWGKQoZJw1Sg18BAQEBAQEBAQEBAQEBAQEBGQIGEHGDG4ZYh0Ergi8FmROHOocDCok9hW2OSzCBDyUIgkCBWWyIcgEBAQ X-IPAS-Result: A0DjAAD/2XxXhjFSfUpdhRCmQodOhiyFBoF3hhgCgSs6EgEBAQEBAQEBEQEBAQgLCwkhL4IyghsBBRIRDwENARsdAQMMBgUYAgIFEw4CAg8FDxEBBQEiNYdzAQMXBJ4egTE+MYs7gWqCWgWGKQoZJw1Sg18BAQEBAQEBAQEBAQEBAQEBGQIGEHGDG4ZYh0Ergi8FmROHOocDCok9hW2OSzCBDyUIgkCBWWyIcgEBAQ X-IronPort-AV: E=Sophos;i="5.28,318,1464645600"; d="scan'208";a="184031970" Received: from mail-wm0-f49.google.com ([74.125.82.49]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 06 Jul 2016 12:15:33 +0200 Received: by mail-wm0-f49.google.com with SMTP id f126so167757908wma.1 for ; Wed, 06 Jul 2016 03:15:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=kAU6DkRqr9EMyryrSspWNPQxfa4nSkhnyvNxp0ZU4tI=; b=kbES9PoMXXNjEVwRWnOLc+Gw+EvyjoBwLvs8vWdamKKjMiya/fyv4ts/Qcvnbjj2s1 7ignRTtATW8Ce+WUrL3btlYluFfbSWhg/g+w7+JE/tdrFhIwx9ZFR1LJYqUxK3oJXEL7 gWr9sNgwUxkxCmSAn5Mz312ZCWKzuFKL7TAvw/e7cq+xm9fas343TWeweWjgqug+w/C4 ZpQXhF8gLfa/3k7SnLsk7J5KM5eo7TsoTrFW35ei2gaBNd6mlTAMfl/XyF4VSEORputS lNZn/Y1PMzltRiIjq0PenT4liwI9oFJEYbOmfdWXCYMhmTm03+Wt8+EbRXHlsUdjtMWn u0xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=kAU6DkRqr9EMyryrSspWNPQxfa4nSkhnyvNxp0ZU4tI=; b=jHquIKiNRsttH83drBE9k2s1TZMcLodGy5fnWA8gNHEPg1ecSa52JJtKW06fe4Eq+z 6+ABWiif/7kJH72k20brgr3MfXs41xapnEW0bgkfjtFzbzoeyv+aHxVgo/TY0HG0UjG4 t92KXq6R835L8SFsvIe2fKCyAGx4ntZ/+5Zk0WsEbbr9dmsZwQ0tjWt1JUihLMqJtsjA suY0wHGuGHJ1TdAsJkTJcUR+dqakQPPsHTCzeKjYwQnMdpzM7NwjFAV07/YTZzouee1B y9PqAY9nRpI/Atai8yAubuVLPmjmNDzNGlVR+8MK4P7Evv8G/xMDSru1LDzsVuv52AgI K9GA== X-Gm-Message-State: ALyK8tJ9Z8LpTYGcHe93zHbos6C5bdKhghQZy493E7OS5koaJdp3HTvWg1COFF3OV9Bu2A== X-Received: by 10.28.168.7 with SMTP id r7mr21289861wme.9.1467800133145; Wed, 06 Jul 2016 03:15:33 -0700 (PDT) Received: from dione.int.eideticdew.org ([79.142.225.158]) by smtp.gmail.com with ESMTPSA id b200sm7216836wmb.9.2016.07.06.03.15.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jul 2016 03:15:32 -0700 (PDT) Date: Wed, 6 Jul 2016 12:15:28 +0200 From: Petter Urkedal To: Jocelyn =?utf-8?B?U8Opcm90?= Cc: OCaml Mailing List Message-ID: <20160706101527.GA26606@dione.int.eideticdew.org> References: <64440D5D-1FC8-4C53-9520-D9D3D21F8FE5@univ-bpclermont.fr> <44623127-96C5-43FB-828D-0F42DCCBA36B@univ-bpclermont.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <44623127-96C5-43FB-828D-0F42DCCBA36B@univ-bpclermont.fr> User-Agent: Mutt/1.5.24 (2015-08-30) Subject: Re: [Caml-list] Q: functors and "has a" inheritance On 2016-07-06, Jocelyn Sérot wrote: > Hi Nicolas, > > Thanks fro your answer. > If i understand correctly, you mean that if i write, say : > > module type S = sig type t val zero: t end > module type T = sig type t val zero: t end > module Make (X : S) = (struct type t = X.t * X.t let zero = X.zero, X.zero end : T) > module M1 = Make (struct type t = int let zero = 0 end) > module M2 = Make (struct type t = int let zero = 0 end) > > then the compiler will never be able to deduce that M1.t and M2.t are indeed compatible. Am i right ? Gerd nicely explained how, so I'm just add a note about why: 1. If the module contained a function rather than a plain constant, it would be undecidable in general whether the two structures were equal. 2. Even if we could (or adopted syntactic equality as an approximation), it would break abstraction: Structures imported from or depending on external libraries could be coincidentally equal at some point and different after an upgrade. So, we would be left with a rather ad-hoc rule about how to compare structures. The nominal approach taken by OCaml is consistent even if a bit conservative. Note that module paths may include functor applications.