caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Philippe Veber <philippe.veber@gmail.com>
To: caml users <caml-list@inria.fr>
Subject: [Caml-list] Accessing values calculated by Toploop.execute_phrase
Date: Thu, 11 Feb 2016 15:11:58 +0100	[thread overview]
Message-ID: <CAOOOohQNWy_24PaJStapsPrfwgZxrriM4cLuQr8_y3ROY5_7=g@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 950 bytes --]

Dear list,

  I'm having quite some fun interacting with the toplevel using `Toploop`
and co., and I am now looking for a way to get the values created during a
call to `Toploop.execute_phrase`, which sadly only returns a boolean. I
would like to get these values as `Obj.t` values, so that I could perform
additional computations for certain types.

I'm almost there but not yet:
  - I can find which values were created and what's their type by
collecting `Outcometree.out_path` values when they are printed, but this
doesn't give access to the actual value (represented as an `Obj.t`).
  - I could use `Toploop.getvalue`, but then I could not get results of
evaluations that were not bound to a variable.

Of course I know what I'm trying to do is highly unsafe, so I should
probably think of some other design. Still, out of curiosity, I'd be
interested if somebody knew a solution to this (I mean, besides "Don't do
it" :).

Cheers,
  Philippe.

[-- Attachment #2: Type: text/html, Size: 1159 bytes --]

             reply	other threads:[~2016-02-11 14:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-11 14:11 Philippe Veber [this message]
2016-02-11 14:28 ` Thomas Refis
2016-02-11 15:37   ` Philippe Veber
2016-02-11 15:42     ` Thomas Refis

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='CAOOOohQNWy_24PaJStapsPrfwgZxrriM4cLuQr8_y3ROY5_7=g@mail.gmail.com' \
    --to=philippe.veber@gmail.com \
    --cc=caml-list@inria.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).