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 DAA00303; Sat, 17 May 2003 03:36:27 +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 DAA00638 for ; Sat, 17 May 2003 03:36:25 +0200 (MET DST) Received: from relay.pair.com (relay.pair.com [209.68.1.20]) by nez-perce.inria.fr (8.11.1/8.11.1) with SMTP id h4H1aNT24022 for ; Sat, 17 May 2003 03:36:24 +0200 (MET DST) Received: (qmail 99445 invoked from network); 17 May 2003 01:36:22 -0000 Received: from arda.pair.com (HELO compaqreview.d6.com) (209.68.1.133) by relay.pair.com with SMTP; 17 May 2003 01:36:22 -0000 X-pair-Authenticated: 209.68.1.133 Message-Id: <4.3.2.7.2.20030516182821.042f6dd0@localhost> X-Sender: checker@localhost X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Date: Fri, 16 May 2003 18:35:42 -0700 To: Ville-Pertti Keinonen , "Christophe Poucet" From: Chris Hecker Subject: Re: [Caml-list] Sumtypes of records Cc: In-Reply-To: <62B8AA7D-8241-11D7-A0A9-000393863F70@exomi.com> References: <003e01c31645$2bfa3c00$e50e76d5@j> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Spam: no; 0.00; hecker:01 checker:01 caml-list:01 stupid:01 plop:01 foo:01 record-like:01 chris:01 int:01 constructors:01 match:02 age:96 probably:05 pattern:06 feature:07 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk >>Why can't constructors of sumtypes take nameless records? (Warning stupid >>example follows) >>type plop = Foo | Bar {age : int};; >Probably because it wouldn't make much sense. Either the only way you >could access age in the above is by matching Bar { age = x }, which is not >very useful (you might as well have Bar of int, or a tuple for multiple >fields), I disagree, it would be useful, it's far more self-documenting than a tuple (which usually need a record-like comment right next to their declaration to tell what's what), and you could match the record like Bar x -> x.age and it wouldn't need a type name. I've wanted this feature myself a number of times. >or the record type needs to have a name so that x in the pattern Bar x has >some printable type. It has type { age : int; }, just like int * int has type int * int and doesn't need a name. Does the record need a name for some other reason? Chris ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners