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 WAA05594; Tue, 14 Jan 2003 22:49:11 +0100 (MET) 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 WAA05743 for ; Tue, 14 Jan 2003 22:49:10 +0100 (MET) Received: from epexch01.qlogic.org ([63.170.40.3]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h0ELn9v13369 for ; Tue, 14 Jan 2003 22:49:09 +0100 (MET) Received: from epmailtmp.qlogic.org ([10.20.33.254]) by epexch01.qlogic.org with Microsoft SMTPSVC(5.0.2195.5329); Tue, 14 Jan 2003 15:49:32 -0600 Received: from [10.20.33.146] ([10.20.33.146]) by epmailtmp.qlogic.org with Microsoft SMTPSVC(5.0.2195.4905); Tue, 14 Jan 2003 15:49:32 -0600 Date: Tue, 14 Jan 2003 15:57:48 -0600 (CST) From: Brian Hurt X-X-Sender: Reply-To: Brian Hurt To: Ocaml Mailing List Subject: [Caml-list] Design question: functors or functions? Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-OriginalArrivalTime: 14 Jan 2003 21:49:32.0806 (UTC) FILETIME=[D294BA60:01C2BC16] Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I have a design question for the list at large. I have a library I'm in the process of cleaning up and finalizing, written in Ocaml. This is a library implementing priority search queues- effectively balanced trees, except I need both a way to compare keys and a way to compare the priorities of the data items. Currently, the mli file reads in part: type ('key, 'data) psq_t val init: keycmp:('key -> 'key -> int) -> pricmp:('data -> 'data -> int) -> ('key, 'data) psq_t and the implementation stashes the functions keycmp and pricmp in the datastructure itself. The question I have is wether I should instead be using a functor. The reason I haven't is that I find the functor interface to be somewhat unwieldy, although maybe I just haven't gotten used to it yet. Suggestions are welcome, indeed sought. Brian ------------------- 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