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.5 required=5.0 tests=AWL,SPF_SOFTFAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 44591BBC4 for ; Wed, 18 Mar 2009 18:01:02 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsABAKrFwEnVhjEYjmdsb2JhbACVdAEBAQEJCwgJDwW+JoN8Bg X-IronPort-AV: E=Sophos;i="4.38,385,1233529200"; d="scan'208";a="25809651" Received: from ihsmtp02voda.lis.interhost.com (HELO ihsmtp02cons.lis.interhost.com) ([213.134.49.24]) by mail1-smtp-roc.national.inria.fr with ESMTP; 18 Mar 2009 18:01:01 +0100 Received: from [192.168.1.64] ([77.54.249.136]) by ihsmtp02cons.lis.interhost.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 18 Mar 2009 16:58:07 +0000 Message-ID: <49C128CC.6010300@inescporto.pt> Date: Wed, 18 Mar 2009 17:01:00 +0000 From: Hugo Ferreira User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: Julien SIGNOLES Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Cannot safely evaluate the definition of the recursively-defined module References: <49C0E44F.6040603@inescporto.pt> <49C1199E.3080402@inescporto.pt> <1237394979.7692.138.camel@localhost> In-Reply-To: <1237394979.7692.138.camel@localhost> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 18 Mar 2009 16:58:07.0745 (UTC) FILETIME=[B62E6710:01C9A7EA] X-Spam: no; 0.00; signoles:01 struct:01 pervasives:01 elt:01 ocaml:01 recursive:01 ocaml:01 signoles:01 03.:98 wrote:01 rec:01 caml-list:01 behaviour:01 modules:02 caml:02 Julien SIGNOLES wrote: > 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 > Read the manual. I'll take a look at [2] Thank you. Hugo F. > Hope this helps, > Julien Signoles