Monolune

Examples of Truly Interactive Shells

This is a follow-up on a previous article where truly interactive shells are explained (no, irb and iPython are not interactive). This article will show examples of what interactive shells look like.

There are some shells that I consider truly interactive. One of them is the interactive shell for MIT Scheme which will serve as an example of a primitive interactive shell. By this standard, many other shells would not be considered interactive at all. By this standard, the Python shell (and even iPython) would not be considered interactive.

Here is a sample session in MIT Scheme:

Interaction with the MIT Scheme REPL

This system is primitive in the sense that it is tedious to continuously type (restart x) to start correcting mistakes. At least the user gets a chance to correct mistakes.

The real dream is to have something like this:

Dream shell interaction

The interaction may seem trivial and contrived, but this becomes useful when running more complex code where the ability to effortlessly experiment and correct mistakes on the fly becomes useful.

Having an interactive shell is the start of reducing human-computer friction in programming computers. For industrial grade development, the addition of a time-travelling debugger is essential. Most of the debuggers we currently have can only step forward, not backwards. A time-travelling debugger can step both forwards and backwards without limits. Needless to say, a debugger should allow the modification of state at every stage (e.g. modifying the values of variables). The interactive shells that I have shown look like debuggers. I do not think there should be a difference between shells and debuggers. Both are used for interaction with humans, why make them separate?

EDIT: Why can't our shells be interactive too? Why can't they have good autosuggestions by default? We are capable of building good GUIs. Why not apply those UX principles to the shell? Things like this should be more common:

Eshell - The Emacs Shell

By the way, that's Emacs' Eshell in action. The demo uses Company Mode to provide the autosuggestions. The demo was made only to showcase autosuggestions in a shell, and is not an endorsement of the daily use of Eshell (which in my opinion, is far from perfect for the normal user).