-
Notifications
You must be signed in to change notification settings - Fork 119
Description
Hi, apologies if this is already possible, but I searched high and low on the internet about this, and couldn't find anything, nor does anything in the utop or ocaml documentation point me to how to do this.
You have an example on how to embed the utop toploop into a custom program, which works nicely for me - thanks! However, I'd like to have values from earlier in the program, be already defined when the toploop starts - so that e.g. the user can type #show_val final_state_of_my_program;; etc and explore it a bit. I used to do this quite often in python with the code snippet import code; code.interact(local=locals()) - it Just Works, and is a very nice and easy-to-use "poor man's debugger" that requires no extra learning on how to use a debugger.
Would it be simple to support this sort of thing in utop? I don't mind having to pass in these values explicitly, e.g. using syntax like UTop_main.main_with_idents [("name1", val1); ("name2", val2)] or something like that.