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 PAA08882; Sun, 27 May 2001 15:31:47 +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 PAA08679 for ; Sun, 27 May 2001 15:31:46 +0200 (MET DST) Received: from web11902.mail.yahoo.com (web11902.mail.yahoo.com [216.136.172.186]) by nez-perce.inria.fr (8.11.1/8.10.0) with SMTP id f4RDVjH09465 for ; Sun, 27 May 2001 15:31:45 +0200 (MET DST) Message-ID: <20010527133144.21504.qmail@web11902.mail.yahoo.com> Received: from [24.221.171.193] by web11902.mail.yahoo.com; Sun, 27 May 2001 06:31:44 PDT Date: Sun, 27 May 2001 06:31:44 -0700 (PDT) From: Tom _ Subject: [Caml-list] classes vs modules To: caml-list@inria.fr MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Sorry if this is a FAQ, but it doesn't seem listed. I have been converting some SML code to OCAML, and came across the following issue when converting a Treap (randomized binary tree) data structure (in fact, the analogous issue exists in SML). The obvious module definition for a Treap is a module like (* module-style implementation *) module Treap (Elt: ORDERED) = struct let rec insert e t = ... ... end module IntTreap = Treap(struct type t = int let lt (x:int) y = x 'a -> bool) = object method insert e (t:'a treap) = ... ... end let int_lt (x:int) y = x 'a treap -> 'a treap; ...} let make_treap_ops (lt: 'a -> 'a -> bool) = let insert (e:'a) (t:'a treap) = ... in ... { insert=insert; ... } let int_lt (x:int) y = x