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=1.2 required=5.0 tests=AWL,SPF_FAIL 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 32D49BC37 for ; Wed, 29 Jul 2009 09:40:55 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjICAHOZb0omachmmWdsb2JhbACaCgEBAQEBCAsKBxO6MIQQBYlo X-IronPort-AV: E=Sophos;i="4.43,288,1246831200"; d="scan'208";a="31831189" Received: from mx2.janestcapital.com ([38.105.200.102]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 29 Jul 2009 09:40:54 +0200 Received: from nyc-qsv-mail1.delacy.com ([172.25.22.57]) by mx2.janestcapital.com with esmtp (Exim 4.69) (envelope-from ) id 1MW3mO-0000sD-NN; Wed, 29 Jul 2009 03:40:52 -0400 Received: from nyc-qsv-004.delacy.com ([172.25.22.194] helo=qsmtp.delacy.com) by nyc-qsv-mail1.DELACY.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1MW3mO-0001N7-Lu; Wed, 29 Jul 2009 03:40:52 -0400 Received: from lon-qws-008.delacy.com ([172.30.3.108] helo=lon-qws-008) by qsmtp.delacy.com with smtp (Exim 4.63) (envelope-from ) id 1MW3mN-0006R8-HE; Wed, 29 Jul 2009 03:40:52 -0400 Received: by lon-qws-008 (sSMTP sendmail emulation); Wed, 29 Jul 2009 08:40:50 +0100 From: "Mark Shinwell" Date: Wed, 29 Jul 2009 08:40:50 +0100 To: Aaron Bohannon Cc: caml-list@inria.fr Subject: Re: [Caml-list] annotations and type-checking Message-ID: <20090729074050.GK19609@janestcapital.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Spam: no; 0.00; shinwell:01 annotations:01 toplevel:01 28,:98 2009:98 wrote:01 caml-list:01 caml-list:01 expression:02 caml:02 declaration:02 variables:02 let:03 let:03 explicit:04 On Tue, Jul 28, 2009 at 05:47:25PM -0400, Aaron Bohannon wrote: > Why do the first two programs type-check but the thrid one does not? Dark corners of the type system. > let f (x : 'a) : 'a = x in (f true, f 3);; Explicit type variables in this situation are considered "global". They are not generalized until the type of the whole toplevel declaration has been determined. Consequentially, during type-checking of the body of your let expression, 'a is not a generalized variable. There is more detail on similar situations here: http://caml.inria.fr/pub/ml-archives/caml-list/2002/06/a03da53be62c12671a891708c51e85f9.en.html Mark