caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: John Max Skaller <skaller@ozemail.com.au>
To: Bow-Yaw Wang <bywang@saul.cis.upenn.edu>
Cc: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>, caml-list@inria.fr
Subject: Re: [Caml-list] Visitor pattern (was copy of parametrized object)
Date: Wed, 25 Jun 2003 12:37:50 +1000	[thread overview]
Message-ID: <3EF90AFE.8020604@ozemail.com.au> (raw)
In-Reply-To: <200306250106.h5P165p8012530@saul.cis.upenn.edu>

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


      reply	other threads:[~2003-06-25  2:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-24 11:15 [Caml-list] copy of parametrized object Bow-Yaw Wang
2003-06-24 12:36 ` Jacques Garrigue
2003-06-24 12:57   ` Stefano Zacchiroli
2003-06-24 20:33   ` Bow-Yaw Wang
2003-06-25  0:25     ` [Caml-list] Visitor pattern (was copy of parametrized object) Jacques Garrigue
2003-06-25  1:06       ` Bow-Yaw Wang
2003-06-25  2:37         ` John Max Skaller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3EF90AFE.8020604@ozemail.com.au \
    --to=skaller@ozemail.com.au \
    --cc=bywang@saul.cis.upenn.edu \
    --cc=caml-list@inria.fr \
    --cc=garrigue@kurims.kyoto-u.ac.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).