caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Julien SIGNOLES <julien.signoles@cea.fr>
To: Hugo Ferreira <hmf@inescporto.pt>
Cc: Alp Mestan <alp@mestan.fr>, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Cannot safely evaluate the definition of the recursively-defined module
Date: Wed, 18 Mar 2009 17:49:39 +0100	[thread overview]
Message-ID: <1237394979.7692.138.camel@localhost> (raw)
In-Reply-To: <49C1199E.3080402@inescporto.pt>

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


  reply	other threads:[~2009-03-18 16:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-18 12:08 Hugo Ferreira
2009-03-18 12:48 ` [Caml-list] " Alp Mestan
2009-03-18 15:56   ` Hugo Ferreira
2009-03-18 16:49     ` Julien SIGNOLES [this message]
2009-03-18 17:01       ` Hugo Ferreira
2009-03-19  4:01 ` Michael Furr
2009-03-19  8:09   ` Hugo Ferreira
2009-09-25 20:06     ` Guillaume Yziquel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1237394979.7692.138.camel@localhost \
    --to=julien.signoles@cea.fr \
    --cc=alp@mestan.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=hmf@inescporto.pt \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).