Interactive Go REPL
github.com
github.com
Or is it again a "recompile and rerun everything after each new line is added and pretend to be a REPL"? Or is it maybe something inbetween?
It's something inbetween. Pretty much the way it works is it dynamically inserts references to all objects/packages/functions in scope at compile time. It then has an in Go interpreter that uses reflection to be able to interact with those references in a transparent way.
The compiled part is just go so that part interacts the same way. The Go interpreter is only partially complete so there may be a few things that don't work as expected, but should be easy enough to add.
I'm also thinking about adding go1.8 plugin support so you can import new packages during the run instead of specifying them on the command line.
I did not try go-pry yet, but I am very curious to compare it with my own attempt at an interactive Go REPL https://github.com/cosmos72/gomacro
They look similar in several aspects, and different in some key ones. For example, mine does not try to instrument compiled code and, among other things, uses exactly go1.8 plugin to import compiled packages at runtime.
https://chrome.google.com/webstore/detail/better-go-playgrou...
^ this plugin also adds some bells and whistles like syntax highlighting to make it feel like a real IDE.
In contrast, [gore](https://github.com/motemen/gore) lets you start evaluating expressions right away [1], and provides nice REPL short-hand for importing packages [2].
[0]: https://monosnap.com/file/OIO9dwR3n85xSNIdJIapGrBhbqWS4J.png
[1]: https://monosnap.com/file/AzuB6JsqRSN5f07H1ydB5t74Qh9pSA.png
[2]: https://monosnap.com/file/J3llCwPTwAcchYJWZpVG7wdB8fFXZ1.png
The few times I have tried to do serious work in python hasn't really impressed me much in that regard.
Personally, the idea of developing code that way for use in a server brings back many memories, mostly not good, so this is not a big problem for me.
that's a trick though - no one uses interpreters like that. for most people they're for experimentation, which is exactly what i was saying i'm able to do with go.
You work in your real text editor and it has a connection to a persistent session of the language runtime, over which you can send fragments, lines or whole files into. And receive data back if you wish. You can refine or replace as little or as much of the program as you want, while it is running.
Say there's a power cut and your computer turns off. No big deal because you were working in your real text editor and saving source files to disk (but not necessarily sending all of their content into the session).
It's not trivial or a novelty. I get that a traditional line-at-a-time interpreter inside a terminal à la /usr/bin/python isn't super compelling. That's not what I'm talking about.
(I am also a happy user of Go FWIW. It's the C style of programming in a super-refined form (not surprising considering who 2 of its creators are!))
...that's even closer to the style that fast compilation lends itself to
Can't wait to give it a shot!