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 nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 08702BB83 for ; Mon, 3 Jul 2006 15:45:57 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k63Djvm2030577 for ; Mon, 3 Jul 2006 15:45:58 +0200 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 PAA31830 for ; Mon, 3 Jul 2006 15:45:56 +0200 (MET DST) Received: from [128.93.11.101] (buzet.inria.fr [128.93.11.101]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k63DjuMO004256 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 3 Jul 2006 15:45:56 +0200 Message-ID: <44A91F7B.6090204@inria.fr> Date: Mon, 03 Jul 2006 15:45:31 +0200 From: Alain Frisch User-Agent: Thunderbird 1.5.0.2 (X11/20060501) MIME-Version: 1.0 To: Bruno De Fraine Cc: caml-list Subject: Re: [Caml-list] Type from local module would escape its scope? References: <069A1F65-E50C-4363-9CCA-C6CC9A453D09@vub.ac.be> In-Reply-To: <069A1F65-E50C-4363-9CCA-C6CC9A453D09@vub.ac.be> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 44A91F95.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 44A91F94.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; frisch:01 frisch:01 foo:01 foo:01 struct:01 existential:01 well-typed:01 val:01 wrote:01 caml-list:01 abstract:01 int:01 functional:02 scope:03 scope:03 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Bruno De Fraine wrote: > While the following is rejected: > > let foo (ignore: 'a -> unit) = > let module Foo : FOO = > struct > type t = int > let value = 1 > end in > ignore Foo.value > ;; The 'a variable is existential and it must be instantiated (because functional arguments are used monomorphically). Clearly, it will be unified with Foo.t, which is abstract, and so the type for foo, if it were well-typed, would be: val foo: (Foo.t -> unit) -> unit Foo.t would escape its scope, which is not ok. -- Alain