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 KAA17355; Mon, 28 May 2001 10:34:08 +0200 (MET DST) 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 KAA17362 for ; Mon, 28 May 2001 10:34:07 +0200 (MET DST) Received: from uni-sb.de (uni-sb.de [134.96.252.33]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f4S8Y6928287 for ; Mon, 28 May 2001 10:34:06 +0200 (MET DST) Received: from cs.uni-sb.de (cs.uni-sb.de [134.96.252.31]) by uni-sb.de (8.11.3/2001051100) with ESMTP id f4S8Y3Z13268; Mon, 28 May 2001 10:34:04 +0200 (CEST) Received: from mail.cs.uni-sb.de (mail.cs.uni-sb.de [134.96.254.200]) by cs.uni-sb.de (8.11.3/2001043000) with ESMTP id f4S8Y3B12964; Mon, 28 May 2001 10:34:03 +0200 (CEST) Received: from ps.uni-sb.de (grizzly.ps.uni-sb.de [134.96.186.68]) by mail.cs.uni-sb.de (8.11.3/2001041100) with ESMTP id f4S8Y2g12507; Mon, 28 May 2001 10:34:02 +0200 (CEST) X-Authentication-Warning: email: Host grizzly.ps.uni-sb.de [134.96.186.68] claimed to be ps.uni-sb.de Received: from ps.uni-sb.de (zoidberg.ps.uni-sb.de [134.96.186.121]) by ps.uni-sb.de (8.11.0/8.11.0) with ESMTP id f4S8Y1K31324; Mon, 28 May 2001 10:34:01 +0200 Message-ID: <3B120D79.A7ED61D@ps.uni-sb.de> Date: Mon, 28 May 2001 10:34:01 +0200 From: Andreas Rossberg Organization: =?iso-8859-1?Q?Universit=E4t?= des Saarlandes X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.17-14 i686) X-Accept-Language: de, en MIME-Version: 1.0 To: caml-list@inria.fr CC: Tom _ Subject: Re: [Caml-list] classes vs modules References: <20010527235252.69384.qmail@web11906.mail.yahoo.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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