Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jonathan Roewen <jonathan.roewen@gmail.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] toplevellib.cma broken?
Date: Thu, 22 Dec 2005 21:21:06 +1300	[thread overview]
Message-ID: <ad8cfe7e0512220021t10bd53e4i9dbbed9fefc4c444@mail.gmail.com> (raw)
In-Reply-To: <ad8cfe7e0512212159g421e6143ya369c73378d4eadb@mail.gmail.com>

> > Hi,
> >
> > I'm trying to use toplevellib in my kernel, and I'm having some -very-
> > weird problems.
> >
> > Here's a sample session on my kernel:
> >
> > caml> 45;;
> > - : int = 45
> > caml> print_int 4;;
> > Error parsing/evaluating expression: Typecode.Error(_,_)
> > caml> 45.67;;
> > Error parsing/evaluating expression: Failure("float_of_string")
> > caml> 45;;
> > Error parsing/evaluating expression: Failure("float_of_string")

Well, I found the Errors module for formatting exceptions. That seems
to help a little bit.

But I have one really weird problem: all the symbols in Pervasives
aren't defined.

Also: it seems to choke on strings, and invoking functions.

For example: "Base_io.print_int 45;;" gets printed, but then it locks up.

Also, entering "45.67;;" kills the toplevel interpreter.

I have:

try
  Toploop.initialize_toplevel_env();
  let eval txt = let lb = (Lexing.from_string txt) in
    let phr = !Toploop.parse_toplevel_phrase lb in
    Toploop.execute_phrase true Format.std_formatter phr
  in

  while true do
    try
      Console.printf "caml> ";
      ignore (eval (IO.read_line stdin))
    with e -> Errors.report_error Format.std_formatter e;
  done;
with
| Env.Error e -> Env.report_error2 e
| e -> Printf.printf "Toploop died: %s\n" (Printexc.to_string e);

Obviously, the exception escapes the first try/with. Perhaps the
floating point is a problem with DST -- I'll have to double check on
the floating point stuff.

However, the rest is of great importance to me. It's loading
pervasives fine, as far as I can tell. So why aren't the symbols
defined???

Jonathan


  reply	other threads:[~2005-12-22  8:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-22  5:57 Jonathan Roewen
2005-12-22  5:59 ` Jonathan Roewen
2005-12-22  8:21   ` Jonathan Roewen [this message]
2005-12-22 21:46     ` Jonathan Roewen
2005-12-23  0:54       ` Jonathan Roewen

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=ad8cfe7e0512220021t10bd53e4i9dbbed9fefc4c444@mail.gmail.com \
    --to=jonathan.roewen@gmail.com \
    --cc=caml-list@yquem.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