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 TAA06238; Sat, 12 May 2001 19:12:00 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA06229 for ; Sat, 12 May 2001 19:12:00 +0200 (MET DST) Received: from shell5.ba.best.com (shell5.ba.best.com [206.184.139.136]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f4CHBwb24388 for ; Sat, 12 May 2001 19:11:59 +0200 (MET DST) Received: from localhost (bpr@localhost) by shell5.ba.best.com (8.9.3/8.9.2/best.sh) with ESMTP id KAA11394 for ; Sat, 12 May 2001 10:11:57 -0700 (PDT) Date: Sat, 12 May 2001 10:11:57 -0700 (PDT) From: Brian Rogoff To: caml-list@inria.fr Subject: Re: [Caml-list] Record pattern matching In-Reply-To: <3AFB9C04.AD291AC6@ps.uni-sb.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 11 May 2001, Andreas Rossberg wrote: > > > You'd rather be forced to code something like: > > > > > > function { a=a; b=_ } -> a;; > > > > > > where all the fields have to be named, but some of them can > > > be specified as ignored? > > No, but as Don suggested having alternative syntax would be preferable. > SML for example distinguishes the patterns > > {a = p} > > and > > {a = p, ...} This seems like a good solution to this problem. > > I guess the point is that I don't use record pattern matching much, and > > where I do I don't want partial matches. Or at least I have a cases > > where enforcing full matching would catch more bugs. > > This has been my experience as well when modifying record types. OK, just to provide another data point, I use the partial match feature quite a bit. The "..." notation is light enough that the feature is still convenient, which would not be the case if each named field would have to be explicitly named. I've also been reading a lot of SML code that I haven't written lately and I find that notation quite readable and concise. As an aside, the situation with records is still not very satisfying. In some cases I use objects when I really just want flexible records, where I can define functions over all records types with given fields. It seems that would be more "symmetric" too, with respect to polymorphic variants. I gather something like that has been tried already and found wanting? -- Brian ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr