English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    
Browse thread
RE: [Caml-list] # eval line; (?)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Gurr, David (MED, self) <David.Gurr@m...>
Subject: RE: [Caml-list] # eval line; (?)

I think that there is a small catch.  I think that the definition of 
eval is correct, but that if you use it in a toplevel loop, then it
will fail because of the parser not reenterant. -D

> -----Original Message-----
> From: Sami Mäkelä [mailto:sajuma@utu.fi]
> Sent: Thursday, May 09, 2002 12:23 PM
> To: Coletta Rémi
> Cc: caml-list@inria.fr
> Subject: Re: [Caml-list] # eval line; (?)
> 
> 
> > # line;;
> > - : string = "let b = 1;;"
> > 
> > # b;;
> >   ^
> > Unbound value b
> > 
> > I'm looking for a function like "eval" in LISP, that does
> > 
> > # eval line;
> > -: int = 1
> > 
> > #b;;
> > - : int = 1
> 
> Try:
> 
> let eval str =
>   Toploop.execute_phrase true Format.std_formatter
>      (!Toploop.parse_toplevel_phrase (Lexing.from_string str));;
> -------------------
> 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
-------------------
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