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=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 6D52EBBCA for ; Fri, 4 Apr 2008 10:44:13 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAGuH9UfAXQIm/2dsb2JhbACrYQ X-IronPort-AV: E=Sophos;i="4.25,603,1199660400"; d="scan'208";a="24587000" Received: from discorde.inria.fr ([192.93.2.38]) by mail4-smtp-sop.national.inria.fr with ESMTP; 04 Apr 2008 10:44:13 +0200 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m348i61J023004 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Fri, 4 Apr 2008 10:44:12 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aj8BAL+H9UeDrhCRiGdsb2JhbACRTAEBAQ8mmV0 X-IronPort-AV: E=Sophos;i="4.25,603,1199660400"; d="scan'208";a="11058154" Received: from smeltpunt.science.ru.nl ([131.174.16.145]) by mail3-smtp-sop.national.inria.fr with ESMTP; 04 Apr 2008 10:44:11 +0200 Received: from tandem.cs.ru.nl (tandem.cs.ru.nl [131.174.142.18]) by smeltpunt.science.ru.nl (8.13.7/5.23) with ESMTP id m348iAJY026635 for ; Fri, 4 Apr 2008 10:44:10 +0200 (MEST) Received: from tews by tandem.cs.ru.nl with local (Exim 4.63) (envelope-from ) id 1JhhWs-00078o-5r for caml-list@inria.fr; Fri, 04 Apr 2008 10:44:10 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18421.59994.153567.662401@tandem.cs.ru.nl> Date: Fri, 4 Apr 2008 10:44:10 +0200 To: caml-list@inria.fr Subject: recursive modules: Cannot safely evaluate the definition X-Mailer: VM 7.19 under Emacs 21.4.1 From: Hendrik Tews X-Scanned-By: MIMEDefang 2.63 on 131.174.16.145 X-Miltered: at discorde with ID 47F5EA56.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; recursive:01 hendrik:01 tews:01 tews:01 sig:01 sig:01 val:01 val:01 functor:01 functor:01 struct:01 printf:01 printf:01 struct:01 compiler:01 Hi, for the following program module type Result_sig = sig val result : int end module type Build_sig = sig val compute : int -> unit end module rec Rec : functor(Arg : Result_sig) -> Build_sig = functor(Arg : Result_sig) -> struct let compute = function | 0 -> Printf.printf "result: %d\n" Arg.result | n -> let module Arg_x_2 = struct let result = Arg.result * 2 end in let module Rec_tail = Rec(Arg_x_2) in Rec_tail.compute (n-1) end I get the compiler error Cannot safely evaluate the definition of the recursively-defined module Rec Could somebody explain to me why? As far as I can see, module Rec is safe in the sense of section 7.9 of the reference manual. [Background: I am trying to solve the following Ocaml puzzle: Build a (nested) functor application, where the functors applied depend on an input value of the program. In particular the depth of the functor application depends on the input value and could be arbitrary high.] Bye, Hendrik