From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA08567; Tue, 29 May 2001 14:12:43 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA08557 for ; Tue, 29 May 2001 14:12:42 +0200 (MET DST) Received: from indyio.rz.uni-sb.de (indyio.rz.uni-sb.de [134.96.7.3]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f4TCCgD17181 for ; Tue, 29 May 2001 14:12:42 +0200 (MET DST) Received: from mars.rz.uni-sb.de (IDENT:mjEL0rtF2EVwd4e0hiP6icg3XL1ooPfl@mars.rz.uni-sb.de [134.96.7.4]) by indyio.rz.uni-sb.de (8.9.3/8.9.3) with ESMTP id OAA1833338; Tue, 29 May 2001 14:12:41 +0200 (CST) Received: from cs.uni-sb.de (cs.uni-sb.de [134.96.254.254]) by mars.rz.uni-sb.de (8.8.8/8.8.4/8.8.2) with ESMTP id OAA20471062; Tue, 29 May 2001 14:12:40 +0200 (CEST) Received: from mail.cs.uni-sb.de (mail.cs.uni-sb.de [134.96.254.200]) by cs.uni-sb.de (8.11.3/2001043000) with ESMTP id f4TCCdB13038; Tue, 29 May 2001 14:12:39 +0200 (CEST) Received: from ps.uni-sb.de (grizzly.ps.uni-sb.de [134.96.186.68]) by mail.cs.uni-sb.de (8.11.3/2001041100) with ESMTP id f4TCCcg26847; Tue, 29 May 2001 14:12:38 +0200 (CEST) X-Authentication-Warning: email: Host grizzly.ps.uni-sb.de [134.96.186.68] claimed to be ps.uni-sb.de Received: from ps.uni-sb.de (zoidberg.ps.uni-sb.de [134.96.186.121]) by ps.uni-sb.de (8.11.0/8.11.0) with ESMTP id f4TCCcK27627; Tue, 29 May 2001 14:12:38 +0200 Message-ID: <3B139236.C2B435F0@ps.uni-sb.de> Date: Tue, 29 May 2001 14:12:38 +0200 From: Andreas Rossberg Organization: =?iso-8859-1?Q?Universit=E4t?= des Saarlandes X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.17-14 i686) X-Accept-Language: de, en MIME-Version: 1.0 To: caml-list@inria.fr CC: John Max Skaller Subject: Re: [Caml-list] ocaml and named constants References: <20010528143238.D19801@pauillac.inria.fr> <3B12F66C.5F5793F9@ozemail.com.au> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk John Max Skaller wrote: > > > One motivation for this is to be able to put named constants in > > patterns, e.g. > > > > match get_next_byte() with > > mpg_joint_stereo -> ... > > | mpg_78rpm -> ... > > | _ -> ... > > > > which cannot be done in plain ML. > > Is there any semantic reason why > one cannot use variables, or even expressions? Apart from > the obvious syntactic problem. If you allow arbitrary (dynamically determined) values to be matched against, then pattern matching has unbound cost. It might not even terminate in the presence of circular values. OTOH, with the current form, the cost of pattern matching is always linear in the syntactic size of the match. I think it is good design to have potentially costly operations explicit. Moreover, such matching would most likely rely on structural equality. Although this is not a technical problem since OCaml already has structural equality, I would at least consider it questionable to promote its (implicit!) use through such a feature. - Andreas -- Andreas Rossberg, rossberg@ps.uni-sb.de "Computer games don't affect kids. If Pac Man affected us as kids, we would all be running around in darkened rooms, munching pills, and listening to repetitive music." ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr