Via Lambda the Ultimate a pointer to a paper by Alessandro Warth and Alan Kay (PDF) called "Worlds: Controlling the Scope of Side Effects". I didn't get as much out of reading the abstract as I did from the opening paragraphs of the intro:

Suppose that, while browsing the web, you get to a page that has multiple links and it is not clear which one (if any) will lead to the information you're looking for. Maybe the desired information is just one or two clicks away, in which case it makes sense to click on a link, and if you don't find you're looking for, click the back button and try the next link. If the information is more than a few clicks away, it might be better to open the link in a new tab in which you can explore it to arbitrary depths. That way, if you eventually decide that wasn't the way to go, you can close the tab, and easily try a different path. Another option is to open each link in its own tab, and explore all of them "concurrently".

Something like the tabs of a web browser would be even more useful in a programming language, where undoing actions is a lot trickier than clicking a back button. As an example, consider the task of programming a robot to open a locked safe, as shown in Figure 1. There are two keys, A and B (each in its own room), but only one of them unlocks the safe. Using a conventional programming language, we might tell the robot to grab key A from room A, then go to the safe and try to unlock it. At this point, if we find that key A does not open the safe, we probably want to have the robot clean up after himself before trying the next alternative (nobody likes a messy robot). So we must tell the robot to take key A back to room A, and then return to its initial position.

In a programming language that supports "tabs", these clean-up actions would not be required: we could simply open a new tab, and inside it try to open the safe with key A. If A turns out to be the wrong key, we can simply close this new tab to return to the initial conditions.

This paper explores the idea of "tabs for programming languages", which we call worlds.

I like this idea. I like that they used Javascript to build their prototype even more. Javascript's extensibility and flexibility make it an interesting place to explore new programming constructs.

Please leave comments using the sidebar.

Last modified: Thu Oct 10 12:47:18 2019.