Hacker News new | ask | show | jobs
by babs474 4584 days ago
I always wonder why more languages don't have this, which I call repl at point, or repl with context. Not sure if there is a more standard name. Even clojure with its generally awesome repl support doesn't have it.

I created a library a while ago that does something very similar to what you did, for the groovy language. http://aaronbabcock.blogspot.com/2011/11/groovy-debugging.ht...

It avoided having to pass in variables explicitly by using groovy's AST transform ability (macros) to examine the code for which variables would be in scope and pass those into the repl automatically. I wonder if something similar would be possible in scala?

3 comments

> I always wonder why more languages don't have this, which I call repl at point, or repl with context.

Users of gdb call it "debugging".

No I think they are related but different. For instance with pdb or the clojure repl I"ll add entire new functions or classes and try them out.

With gdb or jdb that might be theoretically possible but it certainly is not convenient or commonly done. Typically your stretching things with a complicated one liner expression.

But you are right concepts are pretty close, its just that I find a lot of things that call themselves "debuggers" don't have the ability to add new code. Things that call themselves "repls" dont' have the ability to stop at a point or context like a debugger. pdb being the exception. Why can't we have tools that do both things well.

Ah, I forgot to mention gdb as well. gdb and python hooked me on this way of developing.
In clojure, you can do it with a macro [1]. There's also the recent schmetterling [2]

[1] https://coderwall.com/p/xayyvq [2] https://github.com/prismofeverything/schmetterling/

Well, I looked into it but gave up soon-ish because it looked to annoying and my hack was sufficient for me at the time.