From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 9A1BFBB83 for ; Wed, 13 Sep 2006 11:37:22 +0200 (CEST) Received: from mail.rsise.anu.edu.au (mail.rsise.anu.edu.au [150.203.208.4]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k8D9bIDD005029 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 13 Sep 2006 11:37:22 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.rsise.anu.edu.au (Postfix) with ESMTP id 8545653EA6; Wed, 13 Sep 2006 19:36:58 +1000 (EST) Received: from mail.rsise.anu.edu.au ([150.203.208.4]) by localhost (mail [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 30143-07; Wed, 13 Sep 2006 19:36:58 +1000 (EST) Received: from pulp.rsise.anu.edu.au (pulp.rsise.anu.edu.au [150.203.208.49]) by mail.rsise.anu.edu.au (Postfix) with ESMTP id 677A053E9E; Wed, 13 Sep 2006 19:36:48 +1000 (EST) Received: by pulp.rsise.anu.edu.au (Postfix, from userid 1560) id 638F6A0AFC7; Wed, 13 Sep 2006 19:36:50 +1000 (EST) Date: Wed, 13 Sep 2006 19:36:50 +1000 From: Pietro Abate To: caml-list@yquem.inria.fr, caml-list@inria.fr Subject: Re: [Caml-list] Modules within classes Message-ID: <20060913093649.GA29392@pulp.rsise.anu.edu.au> Mail-Followup-To: Pietro Abate , caml-list@yquem.inria.fr, caml-list@inria.fr References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: GNU/Linux X-Organization: Research School of Information Science and Engineering (Australian National University) User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at mail.rsise.anu.edu.au X-Miltered: at concorde with ID 4507D14F.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; functor:01 sig:01 struct:01 struct:01 2006:98 blog:98 blog:98 wrote:01 workaround:01 caml-list:01 modules:02 module:03 module:03 let:03 let:03 On Wed, Sep 13, 2006 at 09:44:30AM +0200, Martin Hofmann wrote: > Can someone explain what is wrong here and perhaps suggest a workaround? maybe you can try to encapsulate your class in a functor ? but I guess this doesn't really solve your problem... module Make(T : sig type a end) = struct class test ( l : T.a list) = object method result = let module M = struct type t = T.a let compare x y = if x < y then -1 else if x > y then 1 else 0 end in let module MSet = Set.Make(M) in MSet.elements (List.fold_right MSet.add l MSet.empty) end;; end :) p -- ++ Blog: http://blog.rsise.anu.edu.au/?q=pietro ++ ++ "All great truths begin as blasphemies." -George Bernard Shaw ++ Please avoid sending me Word or PowerPoint attachments. See http://www.fsf.org/philosophy/no-word-attachments.html