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=2.5 required=5.0 tests=AWL,RCVD_NUMERIC_HELO, SPF_SOFTFAIL,UNPARSEABLE_RELAY autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 57ED9BBC4 for ; Wed, 18 Mar 2009 17:49:45 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgYCAJLDwEmEqOABmWdsb2JhbACVWBwBAQEBAQgLCgcRQ71mg3wGhHk X-IronPort-AV: E=Sophos;i="4.38,385,1233529200"; d="scan'208";a="22768602" Received: from oxalide-out.extra.cea.fr ([132.168.224.1]) by mail2-smtp-roc.national.inria.fr with ESMTP; 18 Mar 2009 17:49:43 +0100 Received: from pisaure.intra.cea.fr (pisaure.intra.cea.fr [132.166.88.21]) by oxalide.extra.cea.fr (8.14.2/8.14.2/CEAnet-Internet-out-1.2) with ESMTP id n2IGljlX018991; Wed, 18 Mar 2009 17:47:45 +0100 Received: from muguet2.intra.cea.fr (muguet2.intra.cea.fr [132.166.192.7]) by pisaure.intra.cea.fr (8.14.2/8.14.2) with ESMTP id n2IGpXcc025766; Wed, 18 Mar 2009 17:51:33 +0100 (envelope-from julien.signoles@cea.fr) Received: from mansart.intra.cea.fr (mansart.intra.cea.fr [132.166.88.54]) by muguet2.intra.cea.fr (8.13.8/8.13.8/CEAnet-Intranet-out-1.1) with ESMTP id n2IGnZwx026322; Wed, 18 Mar 2009 17:49:35 +0100 Received: from LAXA.intra.cea.fr ([132.166.64.47]) by mansart.intra.cea.fr with Microsoft SMTPSVC(6.0.3790.3959); Wed, 18 Mar 2009 17:49:35 +0100 Received: from 132.166.135.80 ([132.166.135.80]) by LAXA.intra.cea.fr ([132.166.64.53]) with Microsoft Exchange Server HTTP-DAV ; Wed, 18 Mar 2009 16:49:34 +0000 Received: from is005140 by LAXA.intra.cea.fr; 18 Mar 2009 17:49:39 +0100 Subject: Re: [Caml-list] Cannot safely evaluate the definition of the recursively-defined module From: Julien SIGNOLES To: Hugo Ferreira Cc: Alp Mestan , caml-list@yquem.inria.fr In-Reply-To: <49C1199E.3080402@inescporto.pt> References: <49C0E44F.6040603@inescporto.pt> <49C1199E.3080402@inescporto.pt> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: CEA LIST Date: Wed, 18 Mar 2009 17:49:39 +0100 Message-Id: <1237394979.7692.138.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 X-OriginalArrivalTime: 18 Mar 2009 16:49:35.0515 (UTC) FILETIME=[84DE4EB0:01C9A7E9] X-Spam: no; 0.00; signoles:01 signoles:01 struct:01 pervasives:01 elt:01 ocaml:01 recursive:01 ocaml:01 91191:01 03.:98 rec:01 caml-list:01 cea:01 cea:01 behaviour:01 Hello, > module rec A1 : AA with type q = ASet.t > with type t = string > = struct > type q = ASet.t > type t = string > > let compare s1 s2 = Pervasives.compare s1 s2 > let add e s = ASet.add e s > let empty = ASet.empty > end > and ASet : Set.S with type elt = A1.t > = Set.Make(A1) > > No. It doens't work. > > however I am getting the following error: > > > > Cannot safely evaluate the definition of the recursively-defined module > > (refers to "AA.empty" when implemented as a constant value) That is consistent with the behaviour specified in Section 7.8 of the reference manual [1]. Both A1 and ASet are not safe according to the definition given in this section. So a type error occurs because ocaml does know that the program won't be safely evaluated. For additional details, you could refer to the Xavier Leroy's notes describing the implementation of recursive modules in ocaml [2]. [1] http://caml.inria.fr/pub/docs/manual-ocaml/manual021.html#toc75 [2] http://caml.inria.fr/pub/papers/xleroy-recursive_modules-03.pdf Hope this helps, Julien Signoles -- Researcher-engineer CEA LIST, Software Reliability Lab 91191 Gif-Sur-Yvette Cedex tel:(+33)1.69.08.71.83 fax:(+33)1.69.08.83.95 Julien.Signoles@cea.fr