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 XAA28702; Mon, 2 Jun 2003 23:30:01 +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 XAA28593 for ; Mon, 2 Jun 2003 23:30:00 +0200 (MET DST) Received: from mail1.tpgi.com.au (mail.tpgi.com.au [203.12.160.57]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h52LTwT07253 for ; Mon, 2 Jun 2003 23:29:58 +0200 (MET DST) Received: from ozemail.com.au (203-219-234-174-syd-ts25-2600.tpgi.com.au [203.219.234.174]) (authenticated (0 bits)) by mail1.tpgi.com.au (8.11.6/8.11.6) with ESMTP id h52LTUT31149; Tue, 3 Jun 2003 07:29:39 +1000 Message-ID: <3EDBC1BA.3060707@ozemail.com.au> Date: Tue, 03 Jun 2003 07:29:30 +1000 From: John Max Skaller User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2.1) Gecko/20010901 X-Accept-Language: en-us MIME-Version: 1.0 To: "Marcin 'Qrczak' Kowalczyk" CC: caml-list@inria.fr Subject: Re: [Caml-list] Sumtypes of records References: <4.3.2.7.2.20030516182821.042f6dd0@localhost> <4.3.2.7.2.20030517232318.033e19c0@localhost> <200305180946.12006.qrczak@knm.org.pl> Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ozemail:01 caml-list:01 marcin:01 'qrczak':01 kowalczyk:01 foo:01 pointers:01 structs:01 unions:01 extensively:01 toxteth:01 glebe:01 2037,:01 9660:01 0850:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Marcin 'Qrczak' Kowalczyk wrote: >>type bar_anonymous_record_type_name_123 = { age : int; } >>type foo = Bar bar_anonymous_record_type_name_123 >> > > Ah, I see. Like in Turbo Pascal (I don't know about Pascal in theory) where it > applies to arrays and pointers too. And like structs and unions in C and C++. > > I don't like it because it's confusing. The syntax suggests that record types > are built on the fly like tuples (like in SML) but the semantics is that they > are explicitly defined somewhere like algebraic types. And this would be the > only such case. > > When you would write: > type foo = Foo of {x : int} > type bar = Bar of {x : int} > then this is a type error: > let f (Foo y) = Bar y There is no reason for it. The compiler already does sophisticated signature matching. There's no reason it can't identify all anonymous record types with the same structure the same way it does for tuples (and polymorphic variants). So this *could* be consistently supported if it was deemed useful, but I would have to warn that anonymous types invariable lead to difficult to understand error messages (I use polymorphic variants extensively and regularly get 200 line error messages). -- John Max Skaller, mailto:skaller@ozemail.com.au snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia. voice:61-2-9660-0850 ------------------- 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