caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: "Nicolás Ojeda Bär" <nicolas.ojeda.bar@lexifi.com>
Cc: "Matej Košík" <mail@matej-kosik.net>,
	"Mailing List OCaml" <caml-list@inria.fr>
Subject: Re: [Caml-list] a question about Ocaml toplevel behavior
Date: Mon, 12 Mar 2018 17:50:26 +0900	[thread overview]
Message-ID: <80BFB738-5A8C-4009-8EBC-5C2EB0B742B6@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <CADK7aFNB617x3CS2BFd44=kfD4-Jp8903vcZotducBHrkrBqBQ@mail.gmail.com>

This actually looks like a bug.
Printing a value falls in the category where type information is
"asbolutely necessary”, so it should open the cmi.
Looking at the code, I do not see any immediate reason it wouldn’t work.
Well, it could happen if location.cmi is not available, but then I don’t
see how doing so extra stuff would help.
Can somebody open a PR on Mantis?

Jacques Garrigue

On 2018/03/12 00:06, Nicolás Ojeda Bär wrote:
> 
> Hello Matej,
> 
> My understanding is that the compiler will delay opening a .cmi file
> until absolutely necessary.
> Since it does not need to look into Location in order to compile the
> given phrase, the .cmi is not opened and the type Location.t remains
> abstract. But if you give the compiler an excuse to open location.cmi
> then the definition of the type Location.t will become known to the
> compiler and the toplevel will be able to print the values concretely.
> 
> For example, evaluating Location.none as in you did in your previous
> message in one thing that will cause the compiler to load the
> corresponding .cmi file thereby making Location.t concrete.
> 
> Best wishes,
> Nicolás
> 
> 
> On Sun, Mar 11, 2018 at 2:30 PM, Matej Košík <mail@matej-kosik.net> wrote:
>> Here is ta simplified version of the original question:
>> 
>> If I do:
>> 
>>  #use "topfind";;
>>  #require "compiler-libs.common";;
>>  Parse.implementation (Lexing.from_string "foo");;
>> 
>> What I see is this:
>> 
>>  - : Parsetree.structure =
>>  [{Parsetree.pstr_desc =
>>     Parsetree.Pstr_eval
>>      ({Parsetree.pexp_desc = Parsetree.Pexp_ident <abstr>; pexp_loc = <abstr>;
>>        pexp_attributes = []},
>>      []);
>>    pstr_loc = <abstr>}]
>> 
>> What confuses me is the presence of "<abstr>" stuff.
>> Why are they there?
>> Why don't I see the actual Ocaml terms (which do not belong to abstract types)?
>> 
>> --
>> Caml-list mailing list.  Subscription management and archives:
>> https://sympa.inria.fr/sympa/arc/caml-list
>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>> Bug reports: http://caml.inria.fr/bin/caml-bugs




  parent reply	other threads:[~2018-03-12  8:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-10 17:55 Matej Košík
2018-03-11 13:30 ` Matej Košík
2018-03-11 15:06   ` Nicolás Ojeda Bär
2018-03-11 15:51     ` Matej Košík
2018-03-11 19:17       ` Nicolás Ojeda Bär
2018-03-12  8:44         ` Matej Košík
2018-03-12  8:50     ` Jacques Garrigue [this message]
2018-03-12  9:09       ` Matej Košík

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=80BFB738-5A8C-4009-8EBC-5C2EB0B742B6@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=mail@matej-kosik.net \
    --cc=nicolas.ojeda.bar@lexifi.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).