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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id C9D4B7EDD9 for ; Fri, 5 Oct 2012 13:33:29 +0200 (CEST) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of david.teller@univ-orleans.fr) identity=pra; client-ip=194.167.30.94; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="david.teller@univ-orleans.fr"; x-sender="david.teller@univ-orleans.fr"; x-conformance=sidf_compatible Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of david.teller@univ-orleans.fr designates 194.167.30.94 as permitted sender) identity=mailfrom; client-ip=194.167.30.94; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="david.teller@univ-orleans.fr"; x-sender="david.teller@univ-orleans.fr"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@sucre.univ-orleans.fr) identity=helo; client-ip=194.167.30.94; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="david.teller@univ-orleans.fr"; x-sender="postmaster@sucre.univ-orleans.fr"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvMAAFrEblDCpx5emWdsb2JhbABFhhC5ECMBAQEBAQgLCwcUJ4IhAQUjVQEQCyETAwsCAgkDAgECASsaBg0BBwEBiAUHpV2SaQSQNYESA45ugSCYeg X-IronPort-AV: E=Sophos;i="4.80,541,1344204000"; d="asc'?scan'208";a="158018603" Received: from sucre.univ-orleans.fr ([194.167.30.94]) by mail4-smtp-sop.national.inria.fr with ESMTP; 05 Oct 2012 13:33:29 +0200 Received: from localhost (localhost [127.0.0.1]) by sucre.univ-orleans.fr (Postfix) with ESMTP id 42AFE943B6; Fri, 5 Oct 2012 13:33:30 +0200 (CEST) Received: from sucre.univ-orleans.fr ([127.0.0.1]) by localhost (sucre.univ-orleans.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cDPyinIfDZRk; Fri, 5 Oct 2012 13:33:30 +0200 (CEST) Received: from smtps.univ-orleans.fr (smtps.univ-orleans.fr [194.167.30.152]) by sucre.univ-orleans.fr (Postfix) with ESMTP id 2799C943B3; Fri, 5 Oct 2012 13:33:30 +0200 (CEST) Received: from Niels.local (dau94-10-88-189-211-192.fbx.proxad.net [88.189.211.192]) by smtps.univ-orleans.fr (Postfix) with ESMTP id 7DE7736E60; Fri, 5 Oct 2012 13:33:30 +0200 (CEST) Message-ID: <506EC572.9080906@univ-orleans.fr> Date: Fri, 05 Oct 2012 13:33:06 +0200 From: David Rajchenbach-Teller User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: bob zhang CC: Jacques Carette , Caml List References: <506E51C6.6070607@mcmaster.ca> In-Reply-To: X-Enigmail-Version: 1.4.4 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enigA40255AE2C0E584E4E62947A" X-Validation-by: david.teller@univ-orleans.fr Subject: Re: [Caml-list] Polymorphic Variants for big Ast? This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigA40255AE2C0E584E4E62947A Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable For Opa, we used a variant on the technique. We had a rather complex Ast that was progressively refined through a number of passes. Each pass could remove or add cases, and we wanted to have type guarantees that ast nodes did not escape their scope. To do this, we used something along the lines of type 'variant Expr =3D | Let of ... | ... | Variant of 'variant and 'variant Foo =3D | ... In which ['variant] was instantiated with a polymorphic variant. This gave us considerable flexibility and generally avoided the problem of over-complicated error messages. You can find the full source code at https://github.com/MLstate/opalang/blob/master/compiler/opalang/surfaceAst.= ml =2E Cheers, David --------------enigA40255AE2C0E584E4E62947A Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) iQEcBAEBAgAGBQJQbsVyAAoJED+FkPgNe9W+PC8IAKCKJzCRzrvHK5I18HOldDfr 6qxLJd8giR/8wpqqJM6zq4Jy7D39arUYnkmwqQ/ZWYKCeFVktcEfnbimBZlPkQCX xqYmHC+sEyToXH+SppudCN9k4mpjpVuXiRgGLVhDY2SxiLEoqgvKZmE5BAgow1rd HBFjmZjtZ+gFjDs5Sv8cjS7nAZEshFTM9ItrnI/rnpRl0qtrGsykdxZbp8VOalSr iCyVZjgz5gDqmORp02O+xdbDzURCMIKxsm+rlb0crXE28aTB2F0SwCRkeEXXwMVI a5+35D3SNFiaddOATDjeapxeUOe8dMCtaukKXlFKMp6zqI892Rif/LsPb3ofJxU= =w5rD -----END PGP SIGNATURE----- --------------enigA40255AE2C0E584E4E62947A--