From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p6QAlbha019253 for ; Tue, 26 Jul 2011 12:47:37 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApECAHyaLk7RVdg2kGdsb2JhbAApDQEBAQEDFAIMCxsBHx4DDQcFAwEHRwISEwESAQUBJAcjG6csCBQBAQEBCQkNBxQEIa1jCowqglCFCDuIbAIDBoY6BI14hHqMSDyDXg X-IronPort-AV: E=Sophos;i="4.67,268,1309730400"; d="ml'?scan'208";a="114063446" Received: from mail-qw0-f54.google.com ([209.85.216.54]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 26 Jul 2011 12:47:31 +0200 Received: by qwc9 with SMTP id 9so272203qwc.27 for ; Tue, 26 Jul 2011 03:47:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=PdEK3J+GQTXr+J184+5puV3IjaWrMDClNDK4Ryy+ji0=; b=MEFM/3l2ixNiWaD0/OyyFPvGZ6kEM0bcp34nwW+2yyMdLz8reRlLJxtPilbeasgI6w yBaCIgdzEKO+AXzJXCnKnxzHW8EoN9YJxkkcg1xXfXB+iivALvfAztXHRfIMSTUbzubo 4iUuIAY1pMkke0k0Ys5Vso4TH0SR7895i+3b4= MIME-Version: 1.0 Received: by 10.229.135.13 with SMTP id l13mr3384692qct.288.1311677250711; Tue, 26 Jul 2011 03:47:30 -0700 (PDT) Received: by 10.229.241.129 with HTTP; Tue, 26 Jul 2011 03:47:30 -0700 (PDT) In-Reply-To: References: Date: Tue, 26 Jul 2011 12:47:30 +0200 Message-ID: From: Polux Moon To: caml-list Content-Type: multipart/mixed; boundary=00248c76907696b2a904a8f6a854 Subject: Re: [Caml-list] ICFP 2011: Call for participation --00248c76907696b2a904a8f6a854 Content-Type: multipart/alternative; boundary=00248c76907696b29004a8f6a852 --00248c76907696b29004a8f6a852 Content-Type: text/plain; charset=ISO-8859-1 Hi, I have a type error on code similar to : ----- type 'par t = 'par let ident v = v class alias = object method alias : 'a . 'a t -> 'a = ident (* type error here *) end ----- Which gives : ----- Error: This expression has type 'a. 'a t -> 'a but an expression was expected of type 'b. 'b t -> 'b Type 'a a = 'a is not compatible with type 'b t = 'b ----- The problem is related to unification of foralls containing named type in a method. The compiler accepts equivalent code when not using the named type "t" or when not using a method (see attached file). Is it a [known] limitation ? Is there a way to work around it ? --00248c76907696b29004a8f6a852 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi,

I have a type error on code similar to :

-----
type &#= 39;par t =3D 'par

let ident v =3D v

class alias =3D
ob= ject
=A0 method alias : 'a . 'a t -> 'a =3D ident (* type= error here *)
end
-----

Which gives :

-----
Error: This expression ha= s type 'a. 'a t -> 'a
=A0=A0=A0=A0=A0=A0 but an expressio= n was expected of type 'b. 'b t -> 'b
=A0=A0=A0=A0=A0=A0 = Type 'a a =3D 'a is not compatible with type 'b t =3D 'b
-----

The problem is related to unification of foralls containing na= med type in a method.
The compiler accepts equivalent code when not usin= g the named type "t" or when not using a method (see attached fil= e).

Is it a [known] limitation ? Is there a way to work around it ?
--00248c76907696b29004a8f6a852-- --00248c76907696b2a904a8f6a854 Content-Type: text/x-ocaml; charset=US-ASCII; name="forallclass.ml" Content-Disposition: attachment; filename="forallclass.ml" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gqksfmxn0 dHlwZSAncGFyIHQgPSAncGFyCgpsZXQgaWRlbnQgdiA9IHYgKCogaGVyZSBh ZGRpbmcgOiAnYSAuICdhIGEgLT4gJ2EgY2hhbmdlcyBub3RoaW5nICopCgpj bGFzcyBhbGlhcyA9Cm9iamVjdAogIG1ldGhvZCBhbGlhcyA6ICdhIC4gJ2Eg dCAtPiAnYSA9IGlkZW50ICgqIE5PVCBPSyAqKQplbmQKCigqIGJ1dCAqKQps ZXQgYWxpYXMgOiAnYSAuICdhIHQgLT4gJ2EgPSBpZGVudCAoKiBPSyAqKQp0 eXBlIHIgPSB7IGFsaWFzIDogJ2EgLiAnYSB0IC0+ICdhfQpsZXQgYWxpYXMg PSB7IGFsaWFzID0gaWRlbnQgfSAoKiBPSyAqKQoK --00248c76907696b2a904a8f6a854--