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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id CE81DBBAF for ; Mon, 3 Jul 2006 15:55:56 +0200 (CEST) Received: from m14s26.vip-server.net (m14s26.vip-server.net [193.138.181.188]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k63DtvgT006659 for ; Mon, 3 Jul 2006 15:55:57 +0200 Received: from [???c???IPv6:::1] (localhost [127.0.0.1]) by m14s26.vip-server.net (Postfix) with ESMTP id 3283989246 for ; Mon, 3 Jul 2006 15:28:38 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: <069A1F65-E50C-4363-9CCA-C6CC9A453D09@vub.ac.be> References: <069A1F65-E50C-4363-9CCA-C6CC9A453D09@vub.ac.be> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Jean-Marie Gaillourdet Subject: Re: [Caml-list] Type from local module would escape its scope? Date: Mon, 3 Jul 2006 15:38:00 +0200 To: caml-list@yquem.inria.fr X-Pgp-Agent: GPGMail 1.1.2 (Tiger) X-Mailer: Apple Mail (2.752.2) X-Miltered: at concorde with ID 44A921ED.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; hash:01 foo:01 foo:01 struct:01 struct:01 baz:01 1.0:98 wrote:01 caml-list:01 caml-list:01 compile:01 constructor:01 expression:01 argument:01 int:01 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 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, On 03.07.2006, at 15:19, 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 > ;; > > With an error on the expression "Foo.value" stating that "The type > constructor Foo.t would escape its scope". Reading about the > typical case for this error message in http://caml.inria.fr/pub/ml- > archives/caml-list/2002/10/0cf087feab3ef8dc5ccba5a8592472fb.en.html > didn't really help me. Why does it make a difference whether ignore > is an argument? Let us extend your example with the following code: > let foo (ignore: 'a -> unit) = > let module Foo : FOO = > struct > type t = int > let value = 1 > end in > ignore Foo.value > ;; let bar (ignore: 'b -> unit) = let module Foo : FOO = struct type t = float let value = 1.0 end in ignore Foo.value let baz () = let x = ignore in begin foo x; bar x end Which type should x have? Best Regards, Jean-Marie PS: didn't compile that code -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Darwin) iD8DBQFEqR28NIUNP/I5YOgRAoRcAKDKWlxVFBKYfdmBvPJ/T2LYrwKu+ACfYJnK LUIeev+RCMoifUFF5ZNJVK0= =mEs/ -----END PGP SIGNATURE-----