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=2.8 required=5.0 tests=AWL,DNS_FROM_RFC_POST, 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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id CBC8CBBC4 for ; Fri, 6 Mar 2009 17:10:15 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aq4CAGzZsEnRVdmrdGdsb2JhbACMbYdcPwEMCQwHDgaxFAeBAI9CAQMBA4QFBoMIgUQ X-IronPort-AV: E=Sophos;i="4.38,315,1233529200"; d="scan'208";a="23968170" Received: from mail-gx0-f171.google.com ([209.85.217.171]) by mail3-smtp-sop.national.inria.fr with ESMTP; 06 Mar 2009 17:10:15 +0100 Received: by gxk19 with SMTP id 19so868320gxk.3 for ; Fri, 06 Mar 2009 08:10:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:reply-to:to:subject:date :user-agent:cc:references:in-reply-to:content-type :content-transfer-encoding:content-disposition:message-id; bh=13zQ4lOfb5ZKyUJxVdA9P/0j2XqpgJQiV1+V/Gc/7Ys=; b=QSHwEk62merYd9js1yaSVz1LtA80p2l8njxN1m0IYE9qGvxS5xrIYoEpBCDpHebytQ Z/wTXi3rPPSobd1HLCIHcWJ9tUwTzT8536IpD1fX/+AjWlxPpu7lVnpNGSFsbOj64Jw0 Y+dJhswnH30C1FMZobnHIvtxpTX2znv5E9GiA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:reply-to:to:subject:date:user-agent:cc:references:in-reply-to :content-type:content-transfer-encoding:content-disposition :message-id; b=Cysfvv1d9MSS5oIaV8K37v7s4vF0DPglQOdJQSBYZQLjvjT6Zmr9sBTATebfQCgdjU XteU87/w9hwTFLt3nsr/Dar1/OGwjEhjxH8uk2MxKtVel9mKsaFKKud4ZXdxvyIgBmWu XLz7p1XhqdTgnGYDwBEDrA9RAFppdb4ZCUYkE= Received: by 10.100.128.12 with SMTP id a12mr316801and.67.1236355814336; Fri, 06 Mar 2009 08:10:14 -0800 (PST) Received: from ?192.168.0.102? (c-98-219-43-7.hsd1.ga.comcast.net [98.219.43.7]) by mx.google.com with ESMTPS id c28sm2457274anc.45.2009.03.06.08.10.13 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 06 Mar 2009 08:10:13 -0800 (PST) From: Peng Zang Reply-To: peng.zang@gmail.com To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Objects and variants Date: Fri, 6 Mar 2009 11:10:10 -0500 User-Agent: KMail/1.9.9 Cc: Samuel Mimram References: <49B147F7.4090303@ens-lyon.org> In-Reply-To: <49B147F7.4090303@ens-lyon.org> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903061110.12728.peng.zang@gmail.com> X-Spam: no; 0.00; variants:01 hash:01 parametrize:01 cheers:01 beginner's:01 ocaml:01 bug:01 peng:98 peng:98 2009:98 unbound:01 unbound:01 polymorphic:01 beginners:01 wrote:01 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 You're looking for a polymorphic method: class a = object method f : 'a. ([>] as 'a) -> unit = fun _ -> () end Peng On Friday 06 March 2009 10:57:43 am Samuel Mimram wrote: > Hi, > > When I try to compile the following code: > > class a = > object > method f (x:[>]) = () > end > > I get the following error: > > Error: Some type variables are unbound in this type: > class a : object method f : [> ] -> unit end > The method f has type ([> ] as 'a) -> unit where 'a is unbound > > Is the binding of [>] to 'a really necessary here? In particular it is > not mentioned in the inferred type... > > Of course I can parametrize the class over 'a as > > class ['a] a = > object > method f (x:[>] as 'a) = () > end > > which now has type > > class ['a] a : object constraint 'a = [> ] method f : 'a -> unit end > > But this seems rather cumbersome. Is there a way to handle this without > mentioning 'a? > > Thanks! > > Cheers, > > Samuel. > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) iD8DBQFJsUrkfIRcEFL/JewRAqJ3AKC7Dl6+a97yrs1PKPLDEzL5c3vbVACcDdrJ 16BPB2/+ddTB4OHB/4zQ+LA= =ltZH -----END PGP SIGNATURE-----