caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Richard W.M. Jones" <rich@annexia.org>
To: Lauri Alanko <la@iki.fi>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Avoiding ml/mli code duplication
Date: Tue, 28 Dec 2010 14:16:30 +0000	[thread overview]
Message-ID: <20101228141630.GA26760@annexia.org> (raw)
In-Reply-To: <20101228140247.GB12021@melkinpaasi.cs.helsinki.fi>

On Tue, Dec 28, 2010 at 04:02:47PM +0200, Lauri Alanko wrote:
> This does the job, but I'm not quite satisfied. It feels wrong that I
> have to define a functor when I will only ever apply it once. Also,
> the "include module type of" is a recent feature, and it's hard to
> believe there's no solution to this problem before OCaml 3.12.

I think the solution (use of functors) is worse than the problem.
Like OO style, functors make it very hard to examine code and
understand which piece of code is going to run when you call some
function.

> I'd appreciate any suggestions for better solutions.

Just preprocess your code with /bin/cpp, using #include to include a
common file.  Or don't worry about the repeated code too much.

Rich.

-- 
Richard Jones
Red Hat

  reply	other threads:[~2010-12-28 14:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-28 14:02 Lauri Alanko
2010-12-28 14:16 ` Richard W.M. Jones [this message]
2010-12-28 14:59 ` Alain Frisch
2010-12-28 16:54   ` Lauri Alanko

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=20101228141630.GA26760@annexia.org \
    --to=rich@annexia.org \
    --cc=caml-list@inria.fr \
    --cc=la@iki.fi \
    /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).