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=1.0 required=5.0 tests=AWL,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 discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 9E45ABC0A for ; Wed, 14 Feb 2007 21:31:02 +0100 (CET) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.224]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l1EKV18D002984 for ; Wed, 14 Feb 2007 21:31:02 +0100 Received: by nz-out-0506.google.com with SMTP id i11so336617nzh for ; Wed, 14 Feb 2007 12:31:00 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; b=tNZWjZSlzwf6IHu7buSkrkec+byH2SQwLxFAbDuFjjfBP/oacI7FwCqKQzwxgAUGtMwzQd72vwwGxfrh4thN6fByVQad29ho9ryoBy5YccSlKthlCmg41OWpSErKCt/bAFUpPkoQhsW4ascbDaHBkhx+BE+Lcv8dfcdLUkImITs= Received: by 10.35.106.15 with SMTP id i15mr1523069pym.1171485060579; Wed, 14 Feb 2007 12:31:00 -0800 (PST) Received: from ?192.168.0.7? ( [70.243.153.3]) by mx.google.com with ESMTP id f60sm1631102pyh.2007.02.14.12.30.59; Wed, 14 Feb 2007 12:30:59 -0800 (PST) Message-ID: <45D37181.9000001@gmail.com> Date: Wed, 14 Feb 2007 14:30:57 -0600 From: Edgar Friendly User-Agent: Thunderbird 2.0b2 (X11/20070116) MIME-Version: 1.0 To: Gerd Stolpmann Cc: Jacques Carette , caml-list@yquem.inria.fr Subject: Re: [Caml-list] Patterns that evaluate References: <45D23608.4030104@mcmaster.ca> <200702132207.33793.jon@ffconsultancy.com> <45D352F2.3080003@gmail.com> <1171479313.24335.33.camel@localhost.localdomain> <45D35EFF.1000901@mcmaster.ca> <1171481102.24335.39.camel@localhost.localdomain> In-Reply-To: <1171481102.24335.39.camel@localhost.localdomain> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-j-chkmail-Score: MSGID : 45D37185.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 45D37185.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; gerd:01 stolpmann:01 gerd:01 stolpmann:01 syntax:01 semantics:01 o'caml:01 semantics:01 compares:01 tokens:01 edgar:98 equality:01 equality:01 wrote:01 wrote:01 Gerd Stolpmann wrote: > Am Mittwoch, den 14.02.2007, 14:11 -0500 schrieb Jacques Carette: >> Gerd Stolpmann wrote: >>> Before discussing syntax it is more important to >>> define the semantics of such patterns. I mean we have already three >>> predefined kinds of equality in O'Caml: >>> >>> - ( == ) >>> - ( = ) >>> - (fun x y -> compare x y = 0) >>> >>> I admit I do not prefer any one of them. So which equality should be >>> used to test whether the variable is equal to the matched part of the >>> value? >>> >> I would definitely favour structural equality, since that meshes well >> with pattern-matching's semantics. Anything else would seem hard to >> justify, but that's just my opinion. > > It is easy to have another opinion (and that's the basic problem). There > is a good reason to prefer physical equality: pattern matching > decomposes physically anyway, so this equality looks more natural. On > the other hand, the existing string matching (match s with "literal") > compares string contents. > > It is already a mess. > > Gerd If I have to, I think I can satisfy both structural and physical equality with different tokens: If you want: * structural equality, use |= to prefix the pattern case * physical equality, use |== to prefix the pattern case * something else, use | and when to specify whatever explicit guard you want. Does this satisfy all parties? E.