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=1.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id E6A8FBC0A for ; Tue, 27 Feb 2007 22:22:25 +0100 (CET) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.233]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l1RLMO5U024946 for ; Tue, 27 Feb 2007 22:22:25 +0100 Received: by wr-out-0506.google.com with SMTP id i30so2045792wra for ; Tue, 27 Feb 2007 13:22:23 -0800 (PST) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=alPTkpLZ2Vvkq2mvDPP7fPjySDCzF5D8p75P6OpIHZjCnlblKPfM8LKLHWhlPx8HgBx8+4TTRljwI+wAIgNqYIqXFPHKjjjHXFCXavjZkmjtIZdvaEwAUHN6uLnR427e1N3sp3iyinyh8M3O9smin0hp00zGRAkHvWML0JlkgTU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=bofXkfI6P8aNgIK5cdIo0x0p3y6S55ljVNgk0wfLCutQrnTMVjWPtqFV2w7QsyRXUPtGcwFcgZIrEh+Enj5yO0jERb1Qw1Zqf6/qkO4B31BcbJ0fh12+OLXdoEvL0UxekY7EPmeVAmkqd3uTaFGl4Urs2qQW0bqdjGV0f2jFIjw= Received: by 10.114.58.1 with SMTP id g1mr1530580waa.1172611343425; Tue, 27 Feb 2007 13:22:23 -0800 (PST) Received: by 10.114.77.5 with HTTP; Tue, 27 Feb 2007 13:22:23 -0800 (PST) Message-ID: <301730110702271322m72d20cffh37bddb14dc91b6f9@mail.gmail.com> Date: Tue, 27 Feb 2007 13:22:23 -0800 From: "Geoffrey Romer" To: caml-list@inria.fr Subject: Fwd: "ocaml_beginners"::[] Trouble combining polymorphic classes and polymorphic methods In-Reply-To: <301730110702251747y72ae9fbdqd33bd8d08293cbe3@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <301730110702251747y72ae9fbdqd33bd8d08293cbe3@mail.gmail.com> X-j-chkmail-Score: MSGID : 45E4A110.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 45E4A110.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 foo:01 foo:01 escapes:01 polymorphic:01 polymorphic:01 beginners:01 beginners:01 arbitrary:01 compile:01 compiles:01 parameter:02 scope:03 unit:03 [escalated from ocaml_beginners, where I got no response] I'm trying to create a polymorphic class 'a foo which has a polymorphic method that takes as a parameter another foo object, but one with arbitrary type. In other words, something like this: class virtual ['a] foo = object (self) method virtual bar : 'b. 'b foo -> unit end;; When I try to compile this, though, I get a warning that I "cannot quantify 'b because it escapes this scope". When I drop the " 'b. " it compiles fine, but the reported type for bar is 'a foo -> unit; i.e. it's no longer polymorphic. Is there a problem with trying to make a method polymorphic with respect to the class type in this way? How can I make this work?