Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Nicolás Ojeda Bär" <nicolas.ojeda.bar@lexifi.com>
To: "Matej Košík" <mail@matej-kosik.net>
Cc: OCaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] a question about Ocaml toplevel behavior
Date: Sun, 11 Mar 2018 20:17:14 +0100	[thread overview]
Message-ID: <CADK7aFNbNNx=3aFV7p_Xkf-47gof-Otr-iWvWZcYmJKkTE-wZg@mail.gmail.com> (raw)
In-Reply-To: <81818a99-0a21-f5b3-8708-7a4c99d13935@matej-kosik.net>

Hello,

I don't know if there is any deep design reason for this behaviour,
but for one it enables a kind of information hiding: in order to hide
modules which are private to a library and should not be exposed to
the client code, simply do not install the corresponding .cmi files.

Best wishes,
Nicolás


On Sun, Mar 11, 2018 at 4:51 PM, Matej Košík <mail@matej-kosik.net> wrote:
> Hi Nicolás,
>
> Thank you for the reply.
>
> On 03/11/18 16: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.
> I see some of the disadvantages of this behavior:
>
>   (0) I have lost time wondering why things are printed as "<abstr>" instead of the real thing.
>
>   (1) "<abstr>" may (confusingly) mean something else than "a value of an abstract type".
>       It may mean that "toplevel has find an excuse not to load a relevant *.cmi file some so it does not know (yet) how to print a given value.
>       (this is very unintuitive)
>
>   (2) #install_printer directive may have no effect if toplevel has find an excuse not to load relevant *.cmi file.
>       (this is very unintuitive)
>
> Was this done on purpose? What do we gain from this behavior?
> (considering that computer time (as opposed to human time) has ~zero value).

  reply	other threads:[~2018-03-11 19:17 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 [this message]
2018-03-12  8:44         ` Matej Košík
2018-03-12  8:50     ` Jacques Garrigue
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='CADK7aFNbNNx=3aFV7p_Xkf-47gof-Otr-iWvWZcYmJKkTE-wZg@mail.gmail.com' \
    --to=nicolas.ojeda.bar@lexifi.com \
    --cc=caml-list@inria.fr \
    --cc=mail@matej-kosik.net \
    /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