You want it to be a mini-operating system, and the people who did the browser mistook it as an application.
That quote is from Alan Kay when he was asked to elaborate on why he thought that the Internet was built rather well and that the Web was built by amateurs. I recently came across a number of posts and talks on the web regarding asm.js, LLJS, and the rather new suite of developer tools making their way into Firefox that made me think back to this quote. We’ve all been watching for years as the web has nearly come full-circle. We got to a point where the “web” was a bundle of applications that individually spoke various Internet protocols and only loosely worked together. From there the browsers took off on their own and became lean-and-mean rendering machines and distanced themselves from the email clients, news readers, and file transfer programs. Eventually we saw many of these programs move onto the servers and the browsers simply became thin-clients for rendering their interfaces. And now we’re at a point where the browsers aren’t so thin anymore and we’re rushing to try and make this hodgepodge of web technology meaner, leaner, and more useful.
Turtles
To paraphrase the words of a friend I admire, I appreciate software that takes the fundamental idea to its logical extremes. We were talking about programs and software systems that are implemented in terms of themselves. Systems such as Squeak, Emacs, Common Lisp, and the like. We found that these are the sorts of tools and systems we enjoy using the most. And yet as we looked around at the world through our software developer lenses we found that this pattern of software design hasn’t proliferated as much as we would like.
Software that is written in this self-referential style has a unique quality to it. In jocular terms we’d say that, “it’s turtles all the way down.” The same language used by the user to configure it is the same language used to script it. The same language is also used by the programmer who wrote it. The higher levels are all implemented in terms of the level beneath it. And the rabbit-hole goes all the way down, in Lisp-like systems, to the meta-circular interpreter.
I really like this design, “trope” (for lack of a better word). It has the nice side-effect of taking one from being a user to being a programmer without leaving the environment in which you use the software itself. It has a certain consistency to it like the set of rules that govern physical systems that I find particularly intuitive.
Emacs
Someone much wiser than I once told me that Emacs isn’t so much a text editor as it is a Lisp interpreter that happens to have a text editor built into it. This person happened to have written a web server in Emacs. If you are not an Emacs user you might be rolling your eyes. Users of a particularly popular alternative editor like to think that their editor adheres strongly to the Unix principle (do one and only one thing well) but I assure you that it is an illusion as illustrated by the growing repository of extensions to add more useful behaviors (almost nobody uses it to just edit text). The problem with this belief is that in order to implement those extensions one must be willing to drop down to a pseudo-language to write the extensions. If they want to modify this editor they have to know yet another language. Emacs minimizes this penalty by writing as much of itself in terms of itself as is possible (Emacs does have a small C kernel at its center but the majority of it is written in its Lisp dialect known as emacs lisp).
The design of Emacs as such gives it a strong internal consistency that allows for the graceful transition from user to programmer.
In terms of browsers there’s a question that has continued to recur to me of the years: why aren’t they more like Emacs (or Squeak or what-have-you)? Why isn’t there a browser that is turtles all the way down? Many browsers such as Firefox will allow a developer to write extensions using Javascript (for better or worse, the language of the web) and many browser features are implemented in Javascript but there is a wall there in the experience of transition from user to programmer.
For an example of what I mean just open up the “scratchpad,” in Firefox. This is the closest thing I can find to the Emacs scratch buffer in a browser. Now write a function that just prints, “Hello, World!”. If you run that code in that scratch pad it doesn’t just become another function in the running Firefox instance as it would if you had written the function in emacs lisp and evaluated it in Emacs. Firefox provides the user an execution context but user code is not a first-class citizen. I can’t modify Firefox on-the-fly like I can in a system that is built in the self-referential manner I’ve been harping on.
Javascript
As it stands now I agree with Alan Kay. It feels like browsers want to be more like a self-contained operating system that runs applications instead of being an application on a PC desktop. And if we’re going to break that barrier (which many have been working on hard on doing, much to the benefit of observers such as myself) then I think we need to stop thinking of them as script-able applications and build them as environments.
My intuition tells me that Javascript is positioning itself to take over as the language suited for the task. We have a plethora of run-times capable of wickedly-optimized JIT compilation of Javascript code. We have projects like LLJS and asm.js taking care of AOT compilation for client-heavy applications. If there is a way to marry all of these projects into a small core (and for the sake of efficiency a native rendering engine) we could build a kernel around the web. From that kernel we can implement higher layers until we reach the user interface. If we’ve done our job a scratch-pad is a keystroke away and a user can define a function that gets compiled into the run-time and is usable throughout the rest of the browser from the moment they compile it.
The Emacs Browser
The Emacs Browser is just a model. It’s a design philosophy. We don’t want to scare off potential users by association with a notorious tool such as Emacs. However we do want a browser that is extensible by being built from the ground-up in the language of the web as much as is possible. It should be turtles all the way down. It should be a tool that makes it frictionless to go from a user of the web to a developer.
If you, like me, are interested in such a browser then perhaps we should chat sometime. Hit me up on twitter at agentultra and let me know what you think.