From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 4F4A8BB81 for ; Wed, 5 Jan 2005 19:15:39 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j05IFcCl009280 for ; Wed, 5 Jan 2005 19:15:39 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA18577 for ; Wed, 5 Jan 2005 19:15:38 +0100 (MET) Received: from hedwig1.umh.ac.be (hedwig2.umh.ac.be [193.190.193.73]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j05IFc1t019425 for ; Wed, 5 Jan 2005 19:15:38 +0100 Received: from poincare (wigner.swapping.umh.ac.be [10.102.100.18]) by hedwig1.umh.ac.be (8.13.1/8.13.1) with ESMTP id j05IIlBe1155202; Wed, 5 Jan 2005 19:18:47 +0100 Received: from poincare ([127.0.0.1] helo=localhost ident=trch) by poincare with esmtp (Exim 3.36 #1 (Debian)) id 1CmFgW-00060O-00; Wed, 05 Jan 2005 19:15:04 +0100 Date: Wed, 05 Jan 2005 19:14:33 +0100 (CET) Message-Id: <20050105.191433.84857869.Christophe.Troestler@umh.ac.be> To: "O'Caml Mailing List" Subject: The universal variable 'a would escape its scope From: Christophe TROESTLER Organization: Universite de Mons-Hainaut (http://math.umh.ac.be/an/) X-Spook: NASA BATF threat radar Albania USCOI ARPA David John Oates Waco, Texas Legion of Doom X-Blessing: Om Ah Hum Vajra Guru Pema Siddhi Hum X-Operating-System: GNU/Linux (http://www.linux.org/) X-Mailer-URL: http://www.mew.org/ X-Mailer: Mew version 4.1.53 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.1 (www dot roaringpenguin dot com slash mimedefang) X-Miltered: at nez-perce with ID 41DC2ECA.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 41DC2ECA.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; christophe:01 troestler:01 christophe:01 troestler:01 umh:01 cheers:01 abstract:01 expression:01 scope:01 scope:01 coerce:01 constraint:01 caml:02 variant:02 archives:02 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: Hi, I got a variant of the error http://caml.inria.fr/archives/200207/msg00110.html and I do not understand it. Here is a small example showing it: # type 'a t = < output : (string -> unit) -> unit; .. > as 'a;; type 'a t = 'a constraint 'a = < output : (string -> unit) -> unit; .. > # class a = object method f : 'a. 'a t -> unit = fun o -> o#output print_string end;; method f : 'a. 'a t -> unit = fun o -> o#output print_string ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This expression has type < output : (string -> unit) -> unit; .. > but is here used with type < output : (string -> unit) -> unit; .. > The universal variable 'a would escape its scope If I do something with ['a list] instead of ['a t] (or if ['a t] is abstract), I got no problem. If [f] is a function instead of a method, it works. (I do _not_ want to have to coerce the object passed to [f].) Is there something one can do about this? Cheers, ChriS