Deno Repl Programmatically
Python has a really nice not-well-known tool for creating a repl at any point in the code (kinda like a debugger but without any need for all the debugging setup). For example,
I then get a repl where I can poke around with the
a
, b
, error
vars, fix them and when I exit the repl it resumes execution (saving the output to disk so that I don't have to wait another 2 hours)
Is there a way to do this in Deno? e.g. some unstable/hidden Deno.repl()
I know a hacky solution could be made in userland via eval
, but I wanted to check and see if there was an existing way6 Replies
I am not aware of anything like this, though this could be an interesting feature.
Rather than "hacky", I'd say
eval
would be the proper way to use it.It's not ideal, but you can connect devtools to your running process and insert
debugger
where it needs to break. The console will work like a repl.
I like the idea, however!It's hacky cause it won't have auto complete, syntax highlighting, "oh you didn't close a bracket => I'll allow multiline input", etc
It could all be added with enough effort and --unstable
That's indeed true
Ruby has something similar with
binding.irb
(and previously binding.pry
). Drops you into a REPL with debugging commands (next line, step into, step over, etc). It is hands down the best debugging experience I've ever had.