From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 AED90BB91 for ; Thu, 6 Jan 2005 02:56:10 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j061uAAn002307 for ; Thu, 6 Jan 2005 02:56:10 +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 CAA01523 for ; Thu, 6 Jan 2005 02:56:10 +0100 (MET) Received: from mailfe04.swip.net (mailfe04.swip.net [212.247.154.97]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j061u9K1002304 for ; Thu, 6 Jan 2005 02:56:09 +0100 X-T2-Posting-ID: 2IIuXFmkcTpj3lKEFKW25A== Received: from [83.176.169.185] (HELO poincare) by mailfe04.swip.net (CommuniGate Pro SMTP 4.2.7) with ESMTP id 263334796; Thu, 06 Jan 2005 02:56:08 +0100 Received: from poincare ([127.0.0.1] helo=localhost ident=trch) by poincare with esmtp (Exim 3.36 #1 (Debian)) id 1CmMsg-0002EG-00; Thu, 06 Jan 2005 02:56:06 +0100 Date: Thu, 06 Jan 2005 02:56:05 +0100 (CET) Message-Id: <20050106.025605.73797717.Christophe.Troestler@umh.ac.be> To: caml-list@inria.fr Subject: Re: [Caml-list] The universal variable 'a would escape its scope From: Christophe TROESTLER In-Reply-To: <20050106.092413.25912872.garrigue@math.nagoya-u.ac.jp> References: <20050105.191433.84857869.Christophe.Troestler@umh.ac.be> <20050106.092413.25912872.garrigue@math.nagoya-u.ac.jp> Organization: Universite de Mons-Hainaut (http://math.umh.ac.be/an/) X-Spook: Project Monarch warfare Lon Horiuchi eternity server MDA Geraldton enemy of the state Elvis ISEC Europol 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-Miltered: at concorde with ID 41DC9ABA.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 41DC9AB9.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 christophe:01 troestler:01 christophe:01 troestler:01 umh:01 wrote:01 workaround:01 scope:01 jacques:01 unit:02 unit:02 output:02 output:02 string:03 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: On Thu, 06 Jan 2005, Jacques Garrigue wrote: > > The workaround is to use a class-type: > > # class type t = object method output : (string -> unit) -> unit end;; > class type t = object method output : (string -> unit) -> unit end > # class a = object > method f : 'a. (#t as 'a) -> unit = fun o -> o#output print_string > end;; > class a : object method f : #t -> unit end > > This does exactly what you want. Thanks, ChriS