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 20A775D5 for ; Mon, 16 Apr 2018 21:08:21 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.48,460,1517871600"; d="scan'208";a="323115896" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 16 Apr 2018 23:08:19 +0200 Received: by sympa.inria.fr (Postfix, from userid 20132) id 7998A82447; Mon, 16 Apr 2018 23:08: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 8AF8D8240C for ; Mon, 16 Apr 2018 23:08:07 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=gabriel.scherer@gmail.com; spf=Pass smtp.mailfrom=gabriel.scherer@gmail.com; spf=None smtp.helo=postmaster@mail-qk0-f173.google.com IronPort-PHdr: =?us-ascii?q?9a23=3AkPiR4hVYfMbP5U1XDdBoKMbzxHHV8LGtZVwlr6E/?= =?us-ascii?q?grcLSJyIuqrYbBaOt8tkgFKBZ4jH8fUM07OQ7/i7HzRYqb+681k6OKRWUBEEjc?= =?us-ascii?q?hE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRo?= =?us-ascii?q?LerpBIHSk9631+ev8JHPfglEnjWwba98IRmssQndqtQdjJd/JKo21hbHuGZDdf?= =?us-ascii?q?5MxWNvK1KTnhL86dm18ZV+7SleuO8v+tBZX6nicKs2UbJXDDI9M2Ao/8LrrgXM?= =?us-ascii?q?TRGO5nQHTGoblAdDDhXf4xH7WpfxtTb6tvZ41SKHM8D6Uaw4VDK/5KpwVhTmlD?= =?us-ascii?q?kIOCI48GHPi8x/kqRboA66pxdix4LYeZyZOOZicq/Ye94RWGhPUdt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ynBXQoTYp0zYZROAByHNKtih2F1C2vUecY?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AyBADbD9Vaf63cVdFdHgEGDINmPXooC?= =?us-ascii?q?oMeP4NtkSmBdAKBDYdKjRkLI4RgAoI9BxkHAQQ0FAECAQEBAQEBAQEBEwEBCQs?= =?us-ascii?q?LCCYlDII1JAGCSQECAwwXHQEbHQEDDAYDAgsNAgImAgIiAREBBQEcBhMIhGwBA?= =?us-ascii?q?xUPijKPfzyLBYF/BQEXgm8Fg0wKGSYNVFeCHQIGEneGfYFUP4QagwYLBIFegwC?= =?us-ascii?q?CVAKMY4sBCIFhg3iIYoFuil2JLIZkDwMegQQzgXMzGiNQMYISCYILg2iBPokXP?= =?us-ascii?q?DABji8BAQ?= X-IPAS-Result: =?us-ascii?q?A0AyBADbD9Vaf63cVdFdHgEGDINmPXooCoMeP4NtkSmBdAK?= =?us-ascii?q?BDYdKjRkLI4RgAoI9BxkHAQQ0FAECAQEBAQEBAQEBEwEBCQsLCCYlDII1JAGCS?= =?us-ascii?q?QECAwwXHQEbHQEDDAYDAgsNAgImAgIiAREBBQEcBhMIhGwBAxUPijKPfzyLBYF?= =?us-ascii?q?/BQEXgm8Fg0wKGSYNVFeCHQIGEneGfYFUP4QagwYLBIFegwCCVAKMY4sBCIFhg?= =?us-ascii?q?3iIYoFuil2JLIZkDwMegQQzgXMzGiNQMYISCYILg2iBPokXPDABji8BAQ?= X-IronPort-AV: E=Sophos;i="5.48,460,1517871600"; d="scan'208";a="262249430" Received: from mail-qk0-f173.google.com ([209.85.220.173]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 16 Apr 2018 23:08:06 +0200 Received: by mail-qk0-f173.google.com with SMTP id d74so4047378qkg.4 for ; Mon, 16 Apr 2018 14:08:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=/is+yJIFjeQcKtF/Gch5WYQ5lTC7zN860Ro/Xz105gA=; b=GU4zNXPJVjkYZ7umr2x/TlaDdWoOMxfRDSx/Gd8jPW+QlfUijn/H23hIXK25n51WZH Yl/7SurLf4hk+WjixvFXnysW0oWCxuo7S+T4ewUwIUQEmw+SNMLHz6RHA2VHby1r7I3f FbFE0+egOr42e4V+WwrrixB47OYRlTxTKnHcMAKD73ck7EldA56esV3eCN3eaAeSjFpF 3QOkGhP4dlbXEPWWkKV4/9r/DHi5++oDMWGTln1evUrs7Tb8efuPUfb3nD00qZOQ/eeu 9uztwNG4F2AlwOGkr27ntM+aVACmyVHSYyrcONCpCk3igkJSbQOTtblet+/cRlDQ8YLI fvJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=/is+yJIFjeQcKtF/Gch5WYQ5lTC7zN860Ro/Xz105gA=; b=BZzrHVkZOSQ60MhH0cb2/5QtoiInrwkaGuXK/++u0vIUaODa3TpZ/nMvKW0uSII9BG NqcCeNVT5gybxwt/yQkBfw4jHU3xBc9z56uHHm1vgDm7ObNedQ5XYijI1JXfu6PjUNPV U5FEWoEcwInNutJiZIG/umox7+6FdrP1VtAk/eIk6zFgzErRhjWxxl7B0sW81dryIQdp yxVZq5sGL0lGT9zztCPWqUxgMtG4wVn2JTnw8LhJhSqDCoCljLFXSg2hm9E7UzwmDtXJ V/7qfaFFOU5vlUs6U+gsRN0XKYw5qCoUyCFcZM0FuqXnHPnAHqDRJgswpQnDfICrColg EWPg== X-Gm-Message-State: ALQs6tBTDmc2FiE+FkXf4AFTStWvBX2cg/XCtRgUhWvWXqW6oMxbPPV3 4DAcK8HKcMpSl+srOvVkFXQBIkQwOvMLodFKW5Xvxg== X-Google-Smtp-Source: AIpwx4/oWECIUADyHupMuERwIm0Jy+f6tSCIWiVlKXCdJG+EW2b6Hx67Ifh+LQVn6W8WLyCtPrwVAegXW7xS69jpTsM= X-Received: by 10.55.180.197 with SMTP id d188mr5896072qkf.36.1523912885138; Mon, 16 Apr 2018 14:08:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.132.3 with HTTP; Mon, 16 Apr 2018 14:07:24 -0700 (PDT) In-Reply-To: References: From: Gabriel Scherer Date: Tue, 17 Apr 2018 00:07:24 +0300 Message-ID: To: Angelo Corsaro Cc: caml users Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] Recursive record initialisation Reply-To: Gabriel Scherer X-Loop: caml-list@inria.fr X-Sequence: 16823 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: The fact that the declaration is legal does not imply that you can build useful values at this type. (It may be that trying to reject it would naturally lead to reject other types that *are* more interesting, for example.) In this case you can build a value using value recursion, but it is not very interesting: # let rec a =3D { b } and b =3D { a };; val a : atype =3D {b =3D {a =3D }} val b : btype =3D {a =3D {b =3D }} ( Recursive value definitions: http://caml.inria.fr/pub/docs/manual-ocaml/extn.html#s%3Aletrecvalues ) Recursive value definitions are somewhat arcane and rarely used, but still occasionally useful. One downside is that they prevent a purely inductive interpretation of datatypes: if a recursive function is structurally decreasing on one of its argument, there still exists valid OCaml inputs on which it may not terminate. For example, consider List.length on (let rec x =3D 1 :: 2 :: x). On Mon, Apr 16, 2018 at 11:57 PM, Angelo Corsaro wrot= e: > Hello, > > I have a question concerning the initialisation of mutually recursive rec= ord > types. As a trivial example consider the following type declaration: > > type atype =3D { b : btype; } > and btype =3D { a : atype; } > > This is a legal type declaration (it type-checks w/o a blink), but I can= =E2=80=99t > see how such a type would be initialised? As both =E2=80=9Ca" and =E2=80= =9Cb=E2=80=9D are values > there is an apparent bootstrapping issue. But as this is a legal type > declaration I guess there is a way around, wondering what the right way i= s. > > Thanks very much in advance for any clarification. > > =E2=80=94Angelo > > > > > =E2=80=94 > =E2=80=9CSimplicity is the ultimate sophistication." ~ Leonardo da Vinci > --=20 Caml-list mailing list. Subscription management and archives: https://sympa.inria.fr/sympa/arc/caml-list Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs=