caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Andreas Rossberg <rossberg@ps.uni-sb.de>
To: caml-list@inria.fr
Cc: Tom _ <tom7ca@yahoo.com>
Subject: Re: [Caml-list] classes vs modules
Date: Mon, 28 May 2001 10:34:01 +0200	[thread overview]
Message-ID: <3B120D79.A7ED61D@ps.uni-sb.de> (raw)
In-Reply-To: <20010527235252.69384.qmail@web11906.mail.yahoo.com>

Tom _ wrote:
> 
> BTW, I opted for just passing the "lt" function
> as explicit arguments to all the functions in the
> module that need them.  That seems like the most
> general approach, although it means some extra
> arguments and it doesn't guarantee consistency,
> as people might pass incompatible versions of "lt"
> to different calls;

You can avoid this by passing it to the creator
function only and store it inside the object:

	val make_treap : ('a -> 'a -> bool) -> 'a treap

The treap type would look like this:

	type 'a treap' = Empty | ...
	type 'a treap  = {treap' : treap'; lt : 'a -> 'a -> bool}

In most cases I would prefer the functor version, though.

Hope this helps,

	- Andreas

-- 
Andreas Rossberg, rossberg@ps.uni-sb.de

"Computer games don't affect kids.
 If Pac Man affected us as kids, we would all be running around in
 darkened rooms, munching pills, and listening to repetitive music."
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr


  parent reply	other threads:[~2001-05-28  8:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-27 13:31 Tom _
2001-05-27 16:14 ` Markus Mottl
2001-05-27 20:54   ` Brian Rogoff
2001-05-27 23:13     ` Markus Mottl
2001-05-27 23:52     ` Tom _
2001-05-28  4:15       ` Brian Rogoff
2001-05-28  8:34       ` Andreas Rossberg [this message]
2001-05-28  8:24   ` Andreas Rossberg

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=3B120D79.A7ED61D@ps.uni-sb.de \
    --to=rossberg@ps.uni-sb.de \
    --cc=caml-list@inria.fr \
    --cc=tom7ca@yahoo.com \
    /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).