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=AWL 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 5F92DBC0A for ; Thu, 15 Feb 2007 15:10:54 +0100 (CET) Received: from ipmail02.adl2.internode.on.net (ipmail02.adl2.internode.on.net [203.16.214.141]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l1FEAqMR027430 for ; Thu, 15 Feb 2007 15:10:53 +0100 Received: from ppp19-199.lns2.syd7.internode.on.net (HELO rosella) ([59.167.19.199]) by ipmail02.adl2.internode.on.net with ESMTP; 16 Feb 2007 00:40:50 +1030 X-IronPort-AV: i="4.14,175,1170595800"; d="scan'208"; a="85307966:sNHT22405320" Subject: Re: [Caml-list] Patterns that evaluate From: skaller To: Jacques Carette Cc: OCaml In-Reply-To: <45D462EE.5040100@mcmaster.ca> References: <45D23608.4030104@mcmaster.ca> <45D37AD0.3090002@mcmaster.ca> <1171511618.13529.49.camel@rosella.wigram> <45D462EE.5040100@mcmaster.ca> Content-Type: text/plain Date: Fri, 16 Feb 2007 01:10:48 +1100 Message-Id: <1171548648.5669.18.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 45D469EC.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 generality:01 semantics:01 ocaml:01 expr:01 expr:01 'x':01 constructors:01 variants:01 lexically:01 implicitly:01 sourceforge:01 polymorphic:01 lexical:01 wrote:01 On Thu, 2007-02-15 at 08:41 -0500, Jacques Carette wrote: > skaller wrote: > > It is a common wish, but has many problems IMHO. > > First, it isn't very general. > Fallacious argument: OCaml has records, so there is no need for tuples > which are less general. Yet it has them. It isn't an argument, it's a bullet point. > The point is to balance generality with convenience. Yes, I agree. > > patterns from expressions, would be extremely fragile: > Sure. But that is the normal semantics of the rest of OCaml you're > complaining about here! That's only partly true. In much of ocaml, you can use local construction such as let x = expr in expr which names the variable 'x' to be used in 'expr'. There are issues of hijacking of course. However with the pattern thing, the issue is not *which* definition of x you're referring to, but whether you're referring to one at all -- or actually introducing one. Current patterns have two name classes: pattern match variables (lower case first letter) and constructors (upper case first letter or backtick for polymorphic variants, or perhaps a #term for them). Adding a third category suggests a new lexical mark, to keep the 'kind' of the symbol lexically determinate. [Yes, I know Ocaml implicitly introduces variables not only in patterns .. but also type variables] -- John Skaller Felix, successor to C++: http://felix.sf.net