caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: "Stéphane Glondu" <steph@glondu.net>, "Jeremy Yallop" <yallop@gmail.com>
Cc: OCaML List Mailing <caml-list@inria.fr>
Subject: Re: [Caml-list] Change in typing between OCaml 4.01.0 and 4.02.2...
Date: Sun, 28 Jun 2015 18:44:51 +0900	[thread overview]
Message-ID: <AE50001C-0170-4B78-B699-244C27F069F4@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <CAAxsn=HfvGBMz_UKT99X8=j5gZ1J8Uj-Z=f2aJi9h_5gEKLsKw@mail.gmail.com>

On 2015/06/27 04:15, Jeremy Yallop wrote:
> 
> On 26 June 2015 at 19:07, Stéphane Glondu <steph@glondu.net> wrote:
>> $ cat query.mli
>> val make : #App.t -> unit
> 
>> $ cat app.ml
> [...]
>>      Query.make self;
> [...]
>> With OCaml 4.02.2, I get the following error message:
>> 
>>  File "app.ml", line 15, characters 6-12:
>>  Error: This expression has type App.status
>>         It has no method pop
>> 
>> which looks wrong. With OCaml 4.01.0, there is no error.
>> 
>> Does anyone understand what is going on?
> 
> I think this is a result of tighter checks against self-references
> when compiling modules:
> 
>   http://caml.inria.fr/mantis/view.php?id=6886

Indeed, this seems to be the direct cause.
Note that the behavior of referring to oneself through an external
name was never properly defined (most often it would already fail
and even when succeeding it was referring to another definition).
The correct way to do this is either to duplicate the definition of
status in both app and query (removing the cyclic dependency),
or to define it in another file, which can be correctly referred to by both.

Yet, we should probably try to improve the error message,
which is indeed confusing. Not so easy, because this kind of
self-reference can be detected at very unexpected timings.
Can you add a comment to the above bug report?

Jacques Garrigue

  reply	other threads:[~2015-06-28  9:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-26 18:07 Stéphane Glondu
2015-06-26 19:15 ` Jeremy Yallop
2015-06-28  9:44   ` Jacques Garrigue [this message]
2015-06-28 17:04     ` Stéphane Glondu

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=AE50001C-0170-4B78-B699-244C27F069F4@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=steph@glondu.net \
    --cc=yallop@gmail.com \
    /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).