caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Hugo Ferreira <hmf@inescporto.pt>
To: Julien SIGNOLES <julien.signoles@cea.fr>
Cc: 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:01:00 +0000	[thread overview]
Message-ID: <49C128CC.6010300@inescporto.pt> (raw)
In-Reply-To: <1237394979.7692.138.camel@localhost>

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


  reply	other threads:[~2009-03-18 17:01 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
2009-03-18 17:01       ` Hugo Ferreira [this message]
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=49C128CC.6010300@inescporto.pt \
    --to=hmf@inescporto.pt \
    --cc=caml-list@yquem.inria.fr \
    --cc=julien.signoles@cea.fr \
    /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).