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 CB777BB83 for ; Wed, 13 Sep 2006 09:44:30 +0200 (CEST) Received: from acheron.ifi.lmu.de (acheron.ifi.lmu.de [129.187.214.135]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k8D7iUM6015270 for ; Wed, 13 Sep 2006 09:44:30 +0200 Received: from internaldeliver.acheron.ifi.lmu.de (localhost [127.0.0.1]) by acheron.ifi.lmu.de (Postfix) with ESMTP id 38F474376C; Wed, 13 Sep 2006 09:44:30 +0200 (CEST) Received: from orvieto.tcs.ifi.lmu.de (aquila.tcs.ifi.lmu.de [141.84.9.37]) by acheron.ifi.lmu.de (Postfix) with ESMTP id 28DF0435B6; Wed, 13 Sep 2006 09:44:30 +0200 (CEST) Date: Wed, 13 Sep 2006 09:44:30 +0200 (CEST) From: Martin Hofmann To: caml-list@inria.fr Cc: Oliver.Friedmann@web.de Subject: Modules within classes Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at concorde with ID 4507B6DE.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; mhofmann:01 struct:01 ocaml:01 pervasives:01 unbound:01 oliver:01 workaround:01 tcs:01 modules:02 parameter:02 declaration:02 scope:03 seems:03 module:03 module:03 Dear all, Can someone explain what is wrong here and perhaps suggest a workaround? class ['a] test ( l : 'a list) = object method result = let module M = struct type 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;; OCaml says: "Unbound type parameter 'a". Our aim is of course not to program sorting the umpteenth time but to have a means for using Pervasives.Set within a parametrised class. The problem seems to be that although "class ['a]" binds 'a its use is nevertheless disallowed in the scope of the class declaration. Many thanks in advance! Martin Hofmann (on behalf of Oliver Friedmann)