Just curious, why do you want this?
Hi,
Is it possible to modify the toplevel's behavior such that it silently
ignores any re-definitions of already bound identifiers (without
recompiling)? I would like to achieve the following:
# let x = 0;;
val x : int = 0
# let x = 1;;
# x;;
- : int = 0
The following code is supposed to replace all toplevel phrases by
"();;" during parsing (just as an experiment, it renders the toplevel
useless of course).
let original = !Toploop.parse_toplevel_phrase;;
Toploop.parse_toplevel_phrase :=
fun _ -> original (Lexing.from_string ("();;"));;
After executing this, a non-terminating sequence is shown:
- : unit = ()
- : unit = ()
- : unit = ()
...
I'm probably not using the right hook. Any insight would be appreciated.
Best,
Roland
--
http://roland.zumkeller.googlepages.com/
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs