From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: *** X-Spam-Status: No, score=3.0 required=5.0 tests=AWL,DNS_FROM_RFC_POST, HTML_MESSAGE,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 5E66CBBC4 for ; Wed, 15 Apr 2009 04:37:51 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgkCAKLl5ElKfSwckGdsb2JhbACCJTCSez8BAQEBCQkMBxEDqHwHgQKQNQEDAQODeQaFUQ X-IronPort-AV: E=Sophos;i="4.40,189,1238968800"; d="scan'208";a="38489777" Received: from yx-out-2324.google.com ([74.125.44.28]) by mail4-smtp-sop.national.inria.fr with ESMTP; 15 Apr 2009 04:37:50 +0200 Received: by yx-out-2324.google.com with SMTP id 8so1635918yxb.27 for ; Tue, 14 Apr 2009 19:37:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:reply-to:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=Z6tVoDRfAB3syOgWH6VnofqBZjY4nCZQ+zC/UF/9hsY=; b=FgZKNJ/r/n4oyLYhTZrA9v2Iz45BwCW0MM/IlxcOsHAj/pSK6sFyPLSS6pKlT5hsRu Uvgloi/xj8inXMYjpW3qLxUaXz2Gn4PXdcFLtjYm/QBS6p/9HehYb31Y0c85JGB4yma+ +X+09+YdI9ZxEMHSUTl/TrfE3wMs0mWbTlEfQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; b=oCRsWRDeryRxfu7Wk9gs6R6v46swFJKNawCqMgSLqIT6jSpasSLno/Ml/Mr66n5qUo 5f/58ChTdK1UPzbNRf+qj0YxPLC7FsAP7eMu0IeW2/nGmu6w932dqIpV5MWxviofLj47 yv0YskvTR1xQNlLSDhUi1nb0+IJkNC5Dwqspw= MIME-Version: 1.0 Received: by 10.100.251.14 with SMTP id y14mr11789286anh.40.1239763069151; Tue, 14 Apr 2009 19:37:49 -0700 (PDT) Reply-To: yminsky@gmail.com In-Reply-To: <49E53C8A.1090601@naughtydog.com> References: <87skkbuxx8.fsf@aryx.cs.uiuc.edu> <891bd3390904141744k4516f3d0y551f6c572ccadad5@mail.gmail.com> <49E53C8A.1090601@naughtydog.com> Date: Tue, 14 Apr 2009 22:37:49 -0400 Message-ID: <891bd3390904141937l571e34bfgbc6cd69378cca61a@mail.gmail.com> Subject: Re: [Caml-list] pattern matching and records vs tuples From: Yaron Minsky To: Pal-Kristian Engstad Cc: Yoann Padioleau , "caml-list@inria.fr" Content-Type: multipart/alternative; boundary=00163691fefc57e49104678ed5af X-Spam: no; 0.00; yaron:01 minsky:01 yminsky:01 foo:01 foo:01 syntax:01 compiler:01 compiler:01 syntax:01 2009:98 2009:98 wrote:01 wrote:01 clearer:01 clearer:01 --00163691fefc57e49104678ed5af Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On Tue, Apr 14, 2009 at 9:46 PM, Pal-Kristian Engstad < pal_engstad@naughtydog.com> wrote: > Honestly, I'd prefer to have to annotate non-exhaustive records: > > let { foo = foo; bar = bar } = x > > should only match { foo; bar }, but > > let { foo = foo; bar = bar; .. } = x, > > can match records with more labels. > You're right, that seems way better. The syntax is really much clearer, and I like exhaustiveness as the default. The only problem is that it is inconsistent with the current way the compiler behaves. But if you add the exhaustiveness checking only as a flag, and that flag is turned off by the "...", then you're totally set. That's very consistent with other checks in the compiler, such as checks for unused variables. I think this is a great suggestion. I'm curious what Xavier thinks... y --00163691fefc57e49104678ed5af Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Tue, Apr 14, 2009 at 9:46 PM, Pal-Kristian Engstad <= ;pal_engstad@naughtydog.com> wrote:
=20
Honestly, I'd prefer to have to annotate non-exhaustive records:


=A0=A0=A0 let { foo =3D foo; bar =3D bar } =3D x

should only match { foo; bar }, but

=A0=A0=A0 let { foo =3D foo; bar =3D=A0 bar; .. } =3D x,

can match records with more labels.

You're r= ight, that seems way better.=A0 The syntax is really much clearer, and I li= ke exhaustiveness as the default.=A0 The only problem is that it is inconsi= stent with the current way the compiler behaves.=A0 But if you add the exha= ustiveness checking only as a flag, and that flag is turned off by the &quo= t;...", then you're totally set.=A0 That's very consistent wit= h other checks in the compiler, such as checks for unused variables.

I think this is a great suggestion.=A0 I'm curious what Xavier thin= ks...

y

--00163691fefc57e49104678ed5af--