From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 8282FBBAF for ; Tue, 22 Dec 2009 22:49:57 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhEBABLOMEvRVdvikGdsb2JhbACbCT8BAQEBCQkMBxMDrF6FQohZAQIDBYQuBIsx X-IronPort-AV: E=Sophos;i="4.47,438,1257116400"; d="scan'208";a="52671784" Received: from mail-ew0-f226.google.com ([209.85.219.226]) by mail4-smtp-sop.national.inria.fr with ESMTP; 22 Dec 2009 22:49:57 +0100 Received: by ewy26 with SMTP id 26so3149766ewy.3 for ; Tue, 22 Dec 2009 13:49:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:reply-to:received :in-reply-to:references:from:date:x-google-sender-auth:message-id :subject:to:content-type; bh=rN11fttzvW79q73zO72LVh2C4me8IEA0a/HN/sJU/xU=; b=B7TN/zgEA7axgfH6yolkpaoFioZZ6ExWYGdM6pk0MddVo4amnajL3HF60n3fE8dZLZ BCT9dYQzqks1G18pbup0jdcOaE4bG0q8yOXmUc9ZX4VrCg1mh7yt8nC9v79aacmDmoCY RRfl8FxR3FhkKUqlGhxWf+OF5oqIBw8pLNKAo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:reply-to:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type; b=j/+hmiZT1ZW6raXPXhlN97T7yB8rIMrKJK7Q3KGWCzyMRdQ7VSy56VyTaIf/u/quom ESfTR5Kc3YgJcZIHATUsKPXlmcpkYECFEp0vpvzoHTc3hEmEooEqd0wzcdaRi9zmsIiC GHMBRKhBDB6FbZQBXFZh5Zg0rdSKGQ830RSQ8= MIME-Version: 1.0 Sender: cppcrazy@gmail.com Reply-To: boris@yakobowski.org Received: by 10.213.72.207 with SMTP id n15mr9913892ebj.85.1261518596108; Tue, 22 Dec 2009 13:49:56 -0800 (PST) In-Reply-To: <87eimnrv1t.fsf@frosties.localdomain> References: <531142069376641352@orange.fr> <87zl5cmof9.fsf@frosties.localdomain> <76c7f53f0912210600y91c9b76ib07d130cf7cf251f@mail.gmail.com> <87eimnrv1t.fsf@frosties.localdomain> From: Boris Yakobowski Date: Tue, 22 Dec 2009 22:49:35 +0100 X-Google-Sender-Auth: 1fb275135a08f577 Message-ID: <76c7f53f0912221349n409ebb0h9639c576562a87cd@mail.gmail.com> Subject: Re: [Caml-list] obj.magic for polymorphic record fields To: Goswin von Brederlow , caml-list caml-list Content-Type: text/plain; charset=ISO-8859-1 X-Spam: no; 0.00; yakobowski:01 yakobowski:01 inference:01 type-checker:01 2009:98 polymorphic:01 wrote:01 caml-list:01 constraint:01 int:01 int:01 argument:02 boris:04 boris:04 dec:05 On Tue, Dec 22, 2009 at 2:35 PM, Goswin von Brederlow wrote: > But the type inference should deduce that in > > (Obj.magic fn) x > > the 'a is actually 'b -> 'c as I am applying an argument to it. Sure, and it does. But it remains that the principal type of (Obj.magic fn) is 'a, without any other constraint on 'a. The fact that you use it with type 'b -> 'c for some 'b and 'c is irrelevant, and the type-checker can safely draw conclusions from the principal type. (This is similar to considering List.map (fun x -> x). It has type 'a list -> 'a list, even though it is used with type int list -> int list if you apply it to [1].) Hope this helps, -- Boris