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.1 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST autolearn=disabled version=3.1.3 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 9198DBBAF for ; Wed, 20 Aug 2008 17:03:54 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsgCAELPq0jAXQIniGdsb2JhbACQZoExAQEBDyCieQM X-IronPort-AV: E=Sophos;i="4.32,240,1217800800"; d="scan'208";a="14137450" Received: from concorde.inria.fr ([192.93.2.39]) by mail2-smtp-roc.national.inria.fr with ESMTP; 20 Aug 2008 17:03:54 +0200 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m7KF3rYA028148 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Wed, 20 Aug 2008 17:03:54 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgIBAMzKq0jZkrEFmmdsb2JhbACQZoExAQEBAQEIBQgHEQOjDAM X-IronPort-AV: E=Sophos;i="4.32,240,1217800800"; d="scan'208";a="16299745" Received: from web27005.mail.ukl.yahoo.com ([217.146.177.5]) by mail1-smtp-roc.national.inria.fr with SMTP; 20 Aug 2008 16:46:23 +0200 Received: (qmail 72894 invoked by uid 60001); 20 Aug 2008 14:46:23 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=pNCuGu7dmAnNEFyWp+I4CQromKztLakWGkAKYGp0XKaO2JgcSKlmMmVk68m32jSItcck+8Vi05c0ESJ4XkI2YKfggU3tO2CRs4RirVvVim12C2GR+gyt/Q1ONJ53DwwHcdi5aAUnTekHRt2jMRbx2sdWXsOdifRAzgcZBDS37PU=; X-YMail-OSG: SSGeGPwVM1mtSGBzZe5zksBdMyfrL.Shg3kH9vvGPnEP.LfaaEz3GACj3wijbzUTam4x8AvIKtG3Ku6Yt.lrYMZAeh7NbcbUCl6BNYSJDY6GBkboHAbYGjMPdA6x0yBo2EBUyzGuuT1ySmq1eaLO3DKY Received: from [82.242.132.106] by web27005.mail.ukl.yahoo.com via HTTP; Wed, 20 Aug 2008 14:46:23 GMT X-Mailer: YahooMailRC/1042.48 YahooMailWebService/0.7.218.2 Date: Wed, 20 Aug 2008 14:46:23 +0000 (GMT) From: Matthieu Wipliez Subject: Re : [Caml-list] Specifying recursive modules? To: caml-list@inria.fr MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Message-ID: <448407.72605.qm@web27005.mail.ukl.yahoo.com> X-Miltered: at concorde with ID 48AC3259.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; matthieu:01 recursive:01 recursive:01 sig:01 struct:01 sig:01 mli:01 mli:01 ocamlc:01 ocamlc:01 syntax:01 matthieu:01 ocaml:01 ocaml's:01 toplevel:01 Hello,=0A=0Aif you want to use recursive modules in the top-level, it seems= that you must use the definition form:=0A=0A Objective Caml version= 3.10.2=0A=0A# module rec Tmp : sig=0A type t =3D Stop | Next of Tmp.t= =0A end =3D=0A struct=0A type t =3D Stop | Next of Tmp.t=0A end;;=0Am= odule rec Tmp : sig type t =3D Stop | Next of Tmp.t end=0A#=0A=0AMy guess i= s that the specification is only valid inside a .mli file. And indeed:=0A= =0Amodrec.mli:=0Amodule rec Tmp : sig type t =3D Stop | Next of Tmp.t end= =0A=0A"ocamlc -c modrec.mli" works fine,=0Awhile=0A"ocamlc -c modrec.ml" (w= ith modrec.ml having the same contents as modrec.mli) complains it has a sy= ntax error.=0A=0AMatthieu=0A=0A----- Message d'origine ----=0A=0A> De : J= =E9r=E9mie Lumbroso =0A> =C0 : caml-list@inri= a.fr=0A> Envoy=E9 le : Mercredi, 20 Ao=FBt 2008, 16h31mn 51s=0A> Objet : [C= aml-list] Specifying recursive modules?=0A> =0A> Hello,=0A> =0A> I'd always= thought of separating specification and definition as=0A> simply not possi= ble in OCaml, but OCaml's reference manual (3.10,=0A> which is, as far as I= can tell, the most recent version of the=0A> documentation) seems to contr= adict my assumption:=0A> =0A> http://caml.inria.fr/pub/docs/manual-ocaml/ma= nual021.html#htoc100=0A> =0A> It says that recursive specifications can be = written as:=0A> =0A> =0A> module rec : { and ... }=0A> =0A> =0A> What= does this mean? When I attempt to use this feature in the=0A> toplevel, it= results in an error:=0A> =0A> =0A> # module rec Tmp : sig=0A> ty= pe t =3D Stop | Next of Tmp.t=0A> end**;;**=0A> Syntax error=0A> = =0A> =0A> On the off-chance that OCaml might explicitly need an "and", I al= so=0A> tried adding a second dummy module to the definition, but no dice ..= .=0A> When I try to use this feature in a .mli/.ml file coupling, I get the= =0A> same (syntax) error. Have I misunderstood the usage? Or has this been= =0A> removed since its introduction (and the documentation not updated=0A> = accordingly)? Or is this a bug?=0A> =0A> J=E9r=E9mie=0A> =0A> _____________= __________________________________=0A> Caml-list mailing list. Subscription= management:=0A> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list= =0A> Archives: http://caml.inria.fr=0A> Beginner's list: http://groups.yaho= o.com/group/ocaml_beginners=0A> Bug reports: http://caml.inria.fr/bin/caml-= bugs=0A=0A=0A=0A _____________________________________________________= ________________________ =0AEnvoyez avec Yahoo! Mail. Une boite mail plus i= ntelligente http://mail.yahoo.fr