Live data from Hacker News

On Repl-Driven Programming

mikelevins.github.io

61–70 of 210 posts

Re: On Repl-Driven Programming

#61

I think it would help as well to list languages that have various levels of 'real repl' implementations. Wonder what modern (systems you can 'make money with') there are that support this. I know common lisp + smalltalk and worked with both and really liked them for these reasons. I miss this functionality all the time as it was far more efficient (to me!) than modern debuggers.

Isn't Python and Matlab a 'real' REPL? They are money makers.

The article describes specific capabilities (full program/system dynamic redefinition) afforded by a real or full REPL.

Python doesn't have that, and it's mentioned explicitly as not having that.

It's not about "existing in the real world" or "real enough to make money with".

Re: On Repl-Driven Programming

#62
What are people’s thoughts on how using vs not using a REPL help or hinder one’s thinking as a programmer. Specifically I mean if you have no REPL and maybe a long compile time you’re forced to put a little more thinking and planning in up front if you don’t want to waste your time. You might be more meticulous in catching bugs. Whereas with a REPL you can throw stuff at the wall. If something breaks you can just tweak variables and structure in real time till it starts working.

That’s just one characterization I came up with off-hand and it may be inaccurate. I’m mostly trying to paint a picture where tools affect the thinking of the programmer.

What are people’s thoughts on this? Does using a REPL or not using a REPL change your thinking and how so?

Re: On Repl-Driven Programming

#63
post #44

Earlier quoted context omitted.

Why not just learn a Lisp yourself? You'll get far more out of it than watching a video. The old adage is still true: learning a Lisp makes you a better programmer. Your choices are: * Common Lisp: install emacs, SBCL and set up SLIME, * Clojure: install emacs, Clojure and set up CIDER, * Scheme: install emacs, racket (or guile) and set up Geiser, * Emacs Lisp: install emacs. You'll notice that they all involve emacs…

Nice reply. In my case, I'm already an effective amateur at Clojure, but I only use the repl for testing ideas and debugging. In the same way there are guides that teach TDD, I would enjoy seeing a RDD (repl-driven ...) tutorial.

In Clojure the "Rich Comment Blocks" are a very common way to use the REPL: https://betweentwoparens.com/rich-comment-blocks

Re: On Repl-Driven Programming

#64
For people who use Clojure (or another REPL-capable language), would you say that this is the main reason why you use it?

Is it common to write Clojure or other REPL-capable languages in a more "traditional" manner (like how one would write say, Java or C)?

Re: On Repl-Driven Programming

#65

For people who use Clojure (or another REPL-capable language), would you say that this is the main reason why you use it? Is it common to write Clojure or other REPL-capable languages in a more "traditional" manner (like how one would write say, Java or C)?

I'm not sure I'd say the REPL is "the main" reason I use Clojure (there are many reasons, really), but it is an important part of the experience.

I don't know of anyone who is experienced in Clojure and works in a "write-compile-test" way like you'd do in C or Java. While it's certainly feasible, it's not how you're supposed to do it.

Re: On Repl-Driven Programming

#66
post #44

Earlier quoted context omitted.

Why not just learn a Lisp yourself? You'll get far more out of it than watching a video. The old adage is still true: learning a Lisp makes you a better programmer. Your choices are: * Common Lisp: install emacs, SBCL and set up SLIME, * Clojure: install emacs, Clojure and set up CIDER, * Scheme: install emacs, racket (or guile) and set up Geiser, * Emacs Lisp: install emacs. You'll notice that they all involve emacs…

Nice reply. In my case, I'm already an effective amateur at Clojure, but I only use the repl for testing ideas and debugging. In the same way there are guides that teach TDD, I would enjoy seeing a RDD (repl-driven ...) tutorial.

You could have a look at this video by Sean Corfield: https://www.youtube.com/watch?v=UFY2rd05W2g It gives you a good idea of what the REPL workflow is like. Sean will give a more in-depth talk about this next week, and it will be available in the London Clojurians channel afterwards, if you're interested.

Re: On Repl-Driven Programming

#67

REPL is very useful, but few months ago I realize[0] that setting a break-point is not easy as people think, because the program can visit the line through multiple paths(function can be a call from different places), so you can spend a lot of time debugging/finding the right path to the line, which means that you probably have to set more break-points to get the program to the right place faster. [0] https://skyalt.…

In lisp I do something like:

  (when (in-state-i-care-about)
    (break))
Many non-lisp debuggers have conditional breakpoints, though they often have a larger performance overhead than the above.

Re: On Repl-Driven Programming

#68

What are people’s thoughts on how using vs not using a REPL help or hinder one’s thinking as a programmer. Specifically I mean if you have no REPL and maybe a long compile time you’re forced to put a little more thinking and planning in up front if you don’t want to waste your time. You might be more meticulous in catching bugs. Whereas with a REPL you can throw stuff at the wall. If something breaks you can just twe…

> Specifically I mean if you have no REPL and maybe a long compile time you’re forced to put a little more thinking and planning in up front if you don’t want to waste your time

Amusingly, to me, this is something people describe as the difference between having to submit punch cards to (or schedule a job on) a mainframe versus having a compiler on your own machine. That having such quick access to the compiler would lead to the "throw stuff at the wall" approach.

IME, faster feedback loops do increase the "throw stuff at the wall" approach, but for those of us who still (mostly) sit back and think, it's an enabler and not (just) a crutch. I can get in the flow much better in a language like Lisp and stay there. If, for instance, there's some confusion in my mind about how a function or data structure works, in C++ it takes me longer (more of a constant factor longer rather than orders of magnitude longer) to write something and test it out (assuming documentation doesn't clear it up for me). But while the time to explore it isn't huge, I've been pulled out of my focus for longer. With Lisp, I can test it in seconds and get right back to whatever I was doing.

But also, when I don't have a REPL, I break my programs into smaller programs (libraries/modules) which can be composed into the larger program I want. This lets me, partially, recreate the REPL experience. Using a test runner (a proper one or an ad hoc one) and a set of small CLI apps that let me use the smaller modules directly I get something approaching the feedback speed of the REPL. With fewer dependencies for any part under test (or as a CLI app), I get much faster compilation speeds vs needing to recompile a much larger program.

Re: On Repl-Driven Programming

#69
post #24

For those of us that don't use Lisp (or Emacs+SLIME), and are stuck with Python/Julia/Lua/etc and Vim may I give a practical recommendation? The Vim-Slime plugin [1] is a half-decent way of making interactive development work. With a bit of tuning you can make it start a terminal emulator window inside Vim, and have it send the current paragraph of your source code into it with a press of a button. While not as great…

Without caring about VIM, this would be my options,

Python IDE tooling on Microsoft stack.

https://docs.microsoft.com/en-us/visualstudio/python/python-...

Juno IDE for Julia

https://junolab.org/

Re: On Repl-Driven Programming

#70
post #5

For what it's worth, IPython's "autoreload" magic and Julia's "Revise" package get you _closer_ to what the author describes. In both cases, one can define functions/classes/structs in a file/module, load it in a repl, create objects etc, modify the file and have the changes propagate through to live objects

You can also add breakpoints which automatically occurs when exceptions are raised. Which is similar to the breakloop functionality mentioned in the article.

I find ipython + ipdb super useful in this regard

But AFAIK neither provide the feature described in the article where you can continue running after an unhandled exception.

Post reply on HN