Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Chris Hecker <checker@d6.com>
To: "Sami Mäkelä" <sajuma@utu.fi>, "Coletta Rémi" <remi.coletta@free.fr>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] # eval line; (?)
Date: Fri, 10 May 2002 11:02:22 -0700	[thread overview]
Message-ID: <4.3.2.7.2.20020510105628.03394360@mail.d6.com> (raw)
In-Reply-To: <3CDACC83.563B15A1@utu.fi>


 > Try:
>let eval str =
>   Toploop.execute_phrase true Format.std_formatter
>      (!Toploop.parse_toplevel_phrase (Lexing.from_string str));;

I think he wants the variable to be bound into the current toplevel 
environment, which this doesn't do:

# b;;
Characters 0-1:
Unbound value b


# let eval str =
   Toploop.execute_phrase true Format.std_formatter
      (!Toploop.parse_toplevel_phrase (Lexing.from_string str));;
val eval : string -> bool = <fun>

# eval "let b = 1;;";;
val b : int = 1
- : bool = true

# b;;
Characters 0-1:
Unbound value b

# eval "b;;";;
Uncaught exception: Typecore.Error(_, _).


Unless I made a mistaken assumption?

I don't think there's any way to bind it into the current toplevel, but 
maybe you could dynamically load a module or hack something with #use or 
something.  I'm using 3.01 still, so maybe this is different on 3.04.

Chris


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2002-05-10 18:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-09 13:58 Coletta Rémi
2002-05-09 19:03 ` Warp
2002-05-09 19:22 ` Sami Mäkelä
2002-05-10 18:02   ` Chris Hecker [this message]
2002-05-10 19:27     ` Sami Mäkelä
2002-05-10 20:39 Gurr, David (MED, self)
2002-05-16 20:23 ` Coletta Rémi

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=4.3.2.7.2.20020510105628.03394360@mail.d6.com \
    --to=checker@d6.com \
    --cc=caml-list@inria.fr \
    --cc=remi.coletta@free.fr \
    --cc=sajuma@utu.fi \
    /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