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=0.0 required=5.0 tests=none 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 747FFBC6C for ; Wed, 14 Feb 2007 20:25:06 +0100 (CET) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l1EJP5Eq022578 for ; Wed, 14 Feb 2007 20:25:06 +0100 Received: from [84.59.102.197] (helo=gate.lan.gerd-stolpmann.de) by mrelayeu.kundenserver.de (node=mrelayeu2) with ESMTP (Nemesis), id 0MKwtQ-1HHPkU3mjU-0003HD; Wed, 14 Feb 2007 20:25:05 +0100 Received: from flakew.lan.gerd-stolpmann.de (fw.lan.gerd-stolpmann.de [192.168.1.1]) by gate.lan.gerd-stolpmann.de (Postfix) with ESMTP id 93D2CC085; Wed, 14 Feb 2007 20:25:02 +0100 (CET) Subject: Re: [Caml-list] Patterns that evaluate From: Gerd Stolpmann To: Jacques Carette Cc: caml-list@yquem.inria.fr In-Reply-To: <45D35EFF.1000901@mcmaster.ca> References: <45D23608.4030104@mcmaster.ca> <200702132207.33793.jon@ffconsultancy.com> <45D352F2.3080003@gmail.com> <1171479313.24335.33.camel@localhost.localdomain> <45D35EFF.1000901@mcmaster.ca> Content-Type: text/plain Date: Wed, 14 Feb 2007 20:25:01 +0100 Message-Id: <1171481102.24335.39.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Provags-ID: kundenserver.de abuse@kundenserver.de login:a6865a839c0178d9aa0ce41878507ea2 X-Provags-ID2: V01U2FsdGVkX19z4uiknI4r7kOyMVffdWpwsMj1bsR9LTsyFwQlCaIhiRACs0tRk6uw92LmqadW9p6KW01PppOtnQyZeCT0S6FFChEx8SSGbPrOL2DjsfXgCr5K03w9/Wgs X-Miltered: at discorde with ID 45D36211.002 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 viktoriastr:01 64293:01 darmstadt:01 6151:01 6151:01 equality:01 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 -- ------------------------------------------------------------ Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de Phone: +49-6151-153855 Fax: +49-6151-997714 ------------------------------------------------------------