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.8 required=5.0 tests=DNS_FROM_RFC_POST,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 89CBCBBAF for ; Wed, 20 Aug 2008 19:17:30 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsgCAOjuq0jAXQIniGdsb2JhbACRWT4BAQEPIJxPhwUBAg X-IronPort-AV: E=Sophos;i="4.32,240,1217800800"; d="scan'208";a="16143388" Received: from concorde.inria.fr ([192.93.2.39]) by mail3-smtp-sop.national.inria.fr with ESMTP; 20 Aug 2008 19:17:29 +0200 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m7KHHST4001004 for ; Wed, 20 Aug 2008 19:17:29 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgIBAEPuq0jRVaK2mmdsb2JhbACRWT4BAQEBAQgFCAcRA5xLhwUBAg X-IronPort-AV: E=Sophos;i="4.32,240,1217800800"; d="scan'208";a="28370737" Received: from el-out-1112.google.com ([209.85.162.182]) by mail4-smtp-sop.national.inria.fr with ESMTP; 20 Aug 2008 19:15:35 +0200 Received: by el-out-1112.google.com with SMTP id z25so103734ele.9 for ; Wed, 20 Aug 2008 10:15:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=/TM/l92eSNjJAjjOHrvYl41blVyjwEF0GT3cog8XGYg=; b=rgLjRF3EsD5Zqx0Z+rDEyDEJm2yomQXzi4/tgwK42K+YAH4lDkBTkQOqkKRzao6BvJ Ud8pUK91D9mSPIOzs+akcTrpmA84D278J8VSJzi0uyJ6hd5+CCITnwi8kNAtDuHnqgh3 kaDRKUl98tjTTh/Dw5E0cu0gToidtMUYzohgU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=ouGrKmuIyMpcAmF4JxH4ESpz/HfN3ScEk14jtP8h69M29SOOHefCOxlsHF73f++Is2 3ooxrMEShgbaVLIBKcHHKmkUSm/fj6fhoBl2VUmb66xBqXZKiansADOKTPyEqNI0Z+p2 jw5bCxbWEEG1xrRHs6k0e9Z89/r3GSqj3+myM= Received: by 10.142.226.3 with SMTP id y3mr105019wfg.56.1219252532883; Wed, 20 Aug 2008 10:15:32 -0700 (PDT) Received: by 10.142.105.11 with HTTP; Wed, 20 Aug 2008 10:15:32 -0700 (PDT) Message-ID: <2b7b425b0808201015r304870bu699899f47f87d38e@mail.gmail.com> Date: Wed, 20 Aug 2008 19:15:32 +0200 From: "=?ISO-8859-1?Q?J=E9r=E9mie_Lumbroso?=" To: "Matthieu Wipliez" , "Martin Jambon" Subject: Re: Re : [Caml-list] Specifying recursive modules? Cc: caml-list@inria.fr In-Reply-To: <448407.72605.qm@web27005.mail.ukl.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <448407.72605.qm@web27005.mail.ukl.yahoo.com> X-Miltered: at concorde with ID 48AC51A8.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; recursive:01 mli:01 sig:01 sig:01 toplevel:01 matthieu:01 recursive:01 struct:01 mli:01 ocamlc:01 ocamlc:01 syntax:01 matthieu:01 ocaml:01 ocaml's:01 Thank you both for your help. I had not tried to encapsulate the specification inside a module type, but I had tried the .mli file: a careless typo (module rec Tmp =3D sig ... instead of module rec Tmp : sig ...) made me think I was obtaining the same error as with the toplevel. J=E9r=E9mie On Wed, Aug 20, 2008 at 4:46 PM, Matthieu Wipliez wrote= : > Hello, > > if you want to use recursive modules in the top-level, it seems that you = must use the definition form: > > Objective Caml version 3.10.2 > > # module rec Tmp : sig > type t =3D Stop | Next of Tmp.t > end =3D > struct > type t =3D Stop | Next of Tmp.t > end;; > module rec Tmp : sig type t =3D Stop | Next of Tmp.t end > # > > My guess is that the specification is only valid inside a .mli file. And = indeed: > > modrec.mli: > module rec Tmp : sig type t =3D Stop | Next of Tmp.t end > > "ocamlc -c modrec.mli" works fine, > while > "ocamlc -c modrec.ml" (with modrec.ml having the same contents as modrec.= mli) complains it has a syntax error. > > Matthieu > > ----- Message d'origine ---- > >> De : J=E9r=E9mie Lumbroso >> =C0 : caml-list@inria.fr >> Envoy=E9 le : Mercredi, 20 Ao=FBt 2008, 16h31mn 51s >> Objet : [Caml-list] Specifying recursive modules? >> >> Hello, >> >> I'd always thought of separating specification and definition as >> simply not possible in OCaml, but OCaml's reference manual (3.10, >> which is, as far as I can tell, the most recent version of the >> documentation) seems to contradict my assumption: >> >> http://caml.inria.fr/pub/docs/manual-ocaml/manual021.html#htoc100 >> >> It says that recursive specifications can be written as: >> >> >> module rec : { and ... } >> >> >> What does this mean? When I attempt to use this feature in the >> toplevel, it results in an error: >> >> >> # module rec Tmp : sig >> type t =3D Stop | Next of Tmp.t >> end**;;** >> Syntax error >> >> >> On the off-chance that OCaml might explicitly need an "and", I also >> tried adding a second dummy module to the definition, but no dice ... >> When I try to use this feature in a .mli/.ml file coupling, I get the >> same (syntax) error. Have I misunderstood the usage? Or has this been >> removed since its introduction (and the documentation not updated >> accordingly)? Or is this a bug? >> >> J=E9r=E9mie >> >> _______________________________________________ >> Caml-list mailing list. Subscription management: >> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list >> Archives: http://caml.inria.fr >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> Bug reports: http://caml.inria.fr/bin/caml-bugs > > > > ____________________________________________________________________= _________ > Envoyez avec Yahoo! Mail. Une boite mail plus intelligente http://mail.ya= hoo.fr > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >