REPLs and Interactive Programming

Mikel Evins has a post from back in December of 2020 that recently popped up in my feed for some reason or another. It’s an interesting post about one of my favorite programming topics: interactive programming. In it, Evins examines REPL driven, interactive programming and why not all REPLs are created equal.

As he says, plenty of languages and development environments have REPLs these days but most of them don’t support interactive programming the way that, say, LISP REPLs do. He gives the example of a function, foo, calling a function bar that does not exist. In most systems that’s a fatal error or crash. In LISP you simply get dropped into a breakloop where you can examine the current run time environment, change variable values, or even define the bar function. When you’re done, the original computation resumes with the modified environment.

It’s hard to provide this type of programming environment and you can’t just bolt it on as an afterthought. It has to be planned from the start the way languages like LISP and Smalltalk are. The characteristic that divides real REPLs from the pretenders is that you have complete access to the compiler and run time while you’re programming. The best examples I know of showing how powerful this can be are from Magnar Sveen and Kris Jenkins that I wrote about here. If you want to see the technique brilliantly demonstrated, watch Jenkins build a Spotify client right before your eyes in 16 minutes.

If you’re unfamiliar with interactive programming, take a look at Evins’ post and be sure to watch the Sveen and Jenkins videos. It’s my favorite way of programming and it may turn out to be yours too.

This entry was posted in Programming and tagged . Bookmark the permalink.