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 6CB6E7F89E for ; Thu, 3 Apr 2014 12:20:40 +0200 (CEST) Received-SPF: Neutral (mail3-smtp-sop.national.inria.fr: domain of simon.cruanes.2007@m4x.org does not assert whether or not 129.104.30.34 is permitted sender) identity=pra; client-ip=129.104.30.34; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="SRS0=zmS1=ZD=m4x.org=simon.cruanes.2007@bounces.m4x.org"; x-sender="simon.cruanes.2007@m4x.org"; x-conformance=sidf_compatible; x-record-type="spf2.0" Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of SRS0=zmS1=ZD=m4x.org=simon.cruanes.2007@bounces.m4x.org designates 129.104.30.34 as permitted sender) identity=mailfrom; client-ip=129.104.30.34; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="SRS0=zmS1=ZD=m4x.org=simon.cruanes.2007@bounces.m4x.org"; x-sender="SRS0=zmS1=ZD=m4x.org=simon.cruanes.2007@bounces.m4x.org"; x-conformance=sidf_compatible; x-record-type="spf2.0" Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of postmaster@mx1.polytechnique.org designates 129.104.30.34 as permitted sender) identity=helo; client-ip=129.104.30.34; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="SRS0=zmS1=ZD=m4x.org=simon.cruanes.2007@bounces.m4x.org"; x-sender="postmaster@mx1.polytechnique.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AosEAMYzPVOBaB4igWdsb2JhbABYg0GDYcIFFg4BARYmKIIlAQEBBCNWEAkCDgoJIQICDwVJiAwEkBmcGKJyF5FnNYEUBJhYgTWUPA X-IPAS-Result: AosEAMYzPVOBaB4igWdsb2JhbABYg0GDYcIFFg4BARYmKIIlAQEBBCNWEAkCDgoJIQICDwVJiAwEkBmcGKJyF5FnNYEUBJhYgTWUPA X-IronPort-AV: E=Sophos;i="4.97,786,1389740400"; d="asc'?scan'208";a="55383272" Received: from mx1.polytechnique.org ([129.104.30.34]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 03 Apr 2014 12:20:39 +0200 Received: from fuck_yeah (mna75-4-82-225-76-110.fbx.proxad.net [82.225.76.110]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.polytechnique.org (Postfix) with ESMTPSA id 323F71408EEE7; Thu, 3 Apr 2014 12:20:39 +0200 (CEST) Date: Thu, 3 Apr 2014 12:20:35 +0200 From: Simon Cruanes To: David Allsopp Cc: Ocaml Mailing List Message-ID: <20140403101410.GA3176@fuck_yeah> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="jho1yZJdad60DJr+" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-AV-Checked: ClamAV using ClamSMTP at svoboda.polytechnique.org (Thu Apr 3 12:20:39 2014 +0200 (CEST)) X-Spam-Flag: No, tests=bogofilter, spamicity=0.005064, queueID=688FC1408EEEA X-Org-Mail: simon.cruanes.2007@polytechnique.org Subject: Re: [Caml-list] Ocaml compiler documentation --jho1yZJdad60DJr+ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Le Thu, 03 Apr 2014, David Allsopp a =C3=A9crit : > Yotam Barnoy wrote: > > 2. What is demonstrated in lines 114-117 regarding polymorphic variant = row fields: > >=20 > >=C2=A0 | Rtag of label * bool * core_type list > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (* [`A]=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 ( true,=C2=A0 [] ) > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 [`A of T]= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 ( false, [T] ) > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 [`A of T1 &= .. & Tn]=C2=A0=C2=A0 ( false, [T1;...Tn] ) > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 [`A of & T1= & .. & Tn] ( true,=C2=A0 [T1;...Tn] ) > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 *) > > > > What does the bool value represent? >=20 > It indicates that the constructor is constant, or that one of the types i= n the conjunction is "empty" (i.e. constant - I don't know what Jacques' te= rminology for that is!) I might miss something, but wouldn't this be more readable if a variant was used instead of booleans? Say, type includes_constant =3D | IncludesConstant | DoesNotIncludeConstant ... | RTag of label * includes_constant * core_type list (* [`A] (IncludesConstant, []) [`A of T] (DoesNotIncludeConstant, [T]) .... It would also be easier to extend. That's just nitpicking but I think it would make the code more explicit by itself. In addition, I never heard about conjunctions in variants, so I'm happy Yotam started this initiative... Cheers, --=20 Simon http://weusepgp.info/ key 49AA62B6 fingerprint 949F EB87 8F06 59C6 D7D3 7D8D 4AC0 1D08 49AA 62B6 --jho1yZJdad60DJr+ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJTPTXkAAoJEErAHQhJqmK2WukQAMrMiSBAheQ0s/9ECFf6OI6+ TiK2zCESiF7KVFhkqtvyr6Nn0I93++W//BFENVFncyR3AOe31XsWHiclsFmodlFB RIekdtVjBaEV56FCi1TIlMYa+vjF0OOzOvzgkApHVIZM7L0zcaMO1HaE+4LBcTWo lJNSG7GFX5Fg3NZKzvm1rhc1mN7gIXCl0T+69CH/i429nzhC9uG+dVLyOtxdAAUG GgjqpApEwHa9Z7+/3y3eGEkhR1HfwGSr0wBOEuj+hxUhpMBNJTBSG2Bm9gSyHgRi +JuNkomxvu7EYU6dtkgslDw9AXDHtoXtquZTP0ms70Hhm9fawBdf0OZ2cALBejcV Jq3vidP3JR6hlITWq5mtNBvNuns2I+G0oc7K2No9mOxPAhSuxyJe0Ypzqob9zjt7 +B+gu72Df2qMm3zc8DTFPQd9PNjGr2Ld05hbZQX9ym+/yThPLldOuulMHe/vI3vj C/5rW3IRzr4e1lll6TGlxaerwXLRzNZLDPDpJR2ZXL2bEwBY7AHpFDoD7xEHR/lo OUjIa3otSZVy+im0S1cgRqGiJkW9R3Y5d4TmW6/5jAIjzLKsSAvDOQChR7OxOoGY 1cFSKKoNCtVwrG2n5rO5U5ImwIfP6IYZh9wMujluf2tkNnWL/fiIoBQ+8n7+cdvd 8biO/bipEmGz1JXKrg12 =b6t4 -----END PGP SIGNATURE----- --jho1yZJdad60DJr+--