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 EAA06213; Wed, 25 Jun 2003 04:38:07 +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 EAA05923 for ; Wed, 25 Jun 2003 04:38:05 +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 h5P2c3f23581 for ; Wed, 25 Jun 2003 04:38:03 +0200 (MET DST) Received: from ozemail.com.au (203-219-234-83-syd-ts25-2600.tpgi.com.au [203.219.234.83]) (authenticated (0 bits)) by mail1.tpgi.com.au (8.11.6/8.11.6) with ESMTP id h5P2bo920216; Wed, 25 Jun 2003 12:37:51 +1000 Message-ID: <3EF90AFE.8020604@ozemail.com.au> Date: Wed, 25 Jun 2003 12:37:50 +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: Bow-Yaw Wang CC: Jacques Garrigue , caml-list@inria.fr Subject: Re: [Caml-list] Visitor pattern (was copy of parametrized object) References: <200306250106.h5P165p8012530@saul.cis.upenn.edu> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ozemail:01 caml-list:01 bow-yaw:01 expressive:01 recognizes:01 lazier:01 annotations:01 toxteth:01 glebe:01 2037,:01 9660:01 0850:01 compiler:01 variants:01 nsw:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Bow-Yaw Wang wrote: > Thanks a lot. Using polymorphic variants solves the problem > beautifully. I'll reorganize my code. Thanks! I use polymorphic variants almost exclusively. They're much more expressive than the ordinary kind. They're generally easier to program with too, but there is one downside, and it is a BIG downside. When you make a mistake, and your variants are large, you can get 200++ line error messages. The situation has been improved so that now the compiler sometimes recognizes when you left out a case (xxx has tag AAA but yyy doesn't). I suggest that polymorphic variants require a lazier, rapid prototyping style of programming: build and test OFTEN so you know that when there is an error, it had to be in the last change you made. That way, you can often ignore the content of the error message, and just look direcly at the code for an error. Also: you will need to use type annotations a bit more heavily to help localise errors. -- 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