News for hackers. Stuff that matters.
Re:Reple: “Replay-Based” REPLs for Compiled Languages by yorwba on Saturday December 22, 2018 @03:53PM (#18742398)
Instead of putting all lines into one big chunk of code that is recompiled and rerun every time, one could instead compile it into a dynamic library with a single function that gets the current variable assignments passed as arguments, executes the single line of code and then waits for input to generate the next dynamic library, which it then loads and calls with the new variable assignment.

However, that solution would require the same level of language-specific knowledge as the modification mentioned below "Limitations" in the blog post. That's also why I never implemented the idea, despite having carried it around in my head for a few years now. Hopefully someone else will eventually get around to implementing it.

Re:Reple: “Replay-Based” REPLs for Compiled Languages by dawg on Sunday December 23, 2018 @03:39AM (#18745098)
This approach is taken by https://github.com/dlang-community/drepl and https://docs.scala-lang.org/overviews/repl/overview.html. While it works surprisingly well, you need to parse and transform the REPL input to emulate some language constructs in the right scope.
Re:Reple: “Replay-Based” REPLs for Compiled Languages by evmar on Saturday December 22, 2018 @05:28PM (#18742853)
This is how http://neugierig.org/software/c-repl/ worked. (See "How it works" in the README: https://github.com/evmar/c-repl/blob/master/README )
Re:Reple: “Replay-Based” REPLs for Compiled Languages by rgoulter on Saturday December 22, 2018 @06:58PM (#18743288)
I made use of ANTLR4 for parsing C to write a "worksheet" (like Swift's Playgrounds) tool: https://github.com/rgoulter/c-worksheet-instrumentor

It's an example of what you can do with "specific to a language", although it'd suffer the same limitation of "slower after a big computation".

Re:Reple: “Replay-Based” REPLs for Compiled Languages by pankajkumar229 on Saturday December 22, 2018 @04:31PM (#18742547)
Could it be done in llvm or another backend so all frontend languages can benefit?