Please do not dismiss the idea right away. I know that it is hard to compete with a mainstream approach that already works (mostly), so my question is partly "academic".

I also am aware that ClojureScript exists and is very cool, but it is a patch on an existing ugly thing, a useful abstraction.

Disclaimer: I am a programmer but not a web developer, and this is why I am soliciting other's feedback. Being a developer and using the web every day and reading up on various topic and viewing the html source of a page from time to time I think I have some idea about web development.

Anyhow, the problems as I see them:

  • The web started out quick and dirty and noob-friendly, but now it takes a great deal of skills to make a good modern interactive web page, and you just have to be good at it in order to be competitive today. This often means that quick and dirty "learn web in 21 days" just does not cut it at all.
  • Html started out quick and dirty, as a noob-friendly protocol. It is currently a mess.
  • JavaScript language is not without its flaws, but ok.
  • CSS appears to be a decent attempt to clean things up. It is worth keeping, at least the idea of it - that you can style the appearance in a separate file.
  • Putting it all together - JavaScript + Html + CSS becomes rather dirty. There have been good ideas/tools that mitigate the problem such as: AJAX libraries abstract away the specific flavors of the JavaScript. Powerful libraries such as JQuery, Node.js, etc. allow doing cool things in JavaScript as imperfect as it is. Google Web Kit does a very good job of translating a GUI design into a web page. Web MVC frameworks such as ASP.Net, RoR, Django abstract things away and do a lot of leg work for you, HOWEVER, these are all abstractions on top of a crappy base.
  • The demand for what the web could do today is ever-increasing; Google's ChromeBook is a manifestation of that. You run a browser full screen and everything that you might want to do - keyboard/mouse interactions, sound, video, games, text, images, power point presentations - everything is happening inside of it. Thanks for the fast browsers and fast computers and "the cloud", but it could be a lot better!

From a graphics point of view, a browser is just a rectangular canvas that you can paint anything on. Currently the browser executable weighs many megabytes because it has to know how to parse Html, JavaScript, CSS and display all of it.

If you start from scratch and realize that it is pretty much just a canvas to be painted, then I think the browser can be much smaller and simpler. The price to pay is having to write a valid program for everything in a funky syntax such as Lisp or Clojure, even for the simplest of things such as displaying a label. That used to be the cool part of the html - if you wanted just to type the paragraph, you would type it verbatim. This rarely happens anymore. If all you want is to just type the paragraph of text, you still have to think about inline or CSS styling, placement. The following piece of HTML (found on the front page of this site)

<a href="/questions/tagged/programming-languages" class="post-tag" title="show questions tagged 'programming-languages'" rel="tag">programming-languages</a> <a href="/questions/tagged/learning" class="post-tag" title="show questions tagged 'learning'" rel="tag">learning</a>

is not that much easier to craft than some alternative Lispy syntax (and I have not put that much thought into it):

(create-link :target "/questions/tagged/programming-languages" :class "post-tag" :title "show questions tagged 'programming-languages'" :rel "tag" :content (text "programming-languages"))

This might not be a valid Clojure syntax; I sort of made it up. It does not have to try to mimic html - in fact that is the point of starting from scratch. The huge advantage here would be that (text ...) and (create-link ...) are not part of the core language that a browser would have to understand. The browser would only need to understand a "safe" Clojure (one that cannot wipe your hard drive clean) and be able to draw and play music and listen to keyboard and mouse and similar things, and everything else - drawing text, playing a video, displaying a combo box and interacting with it would be all done in a carefully designed library.

Why did I choose Clojure? It is a tiny language that can accomplish a lot, plus the philosophy of building complicated programs out of simple building blocks is very attractive.

I do think that being able to support a single powerful language such as Clojure would be enough to accomplish everything that Html and Html5 and CSS and JavaScripts and Silverlight and Flash can accomplish.

Somewhat of a tangential discussion - I think the same is true for LaTeX - it could be redone with Clojure as an underlying language, and a source file would be a full-blown program that spits out a PDF or a ps as it executes.

I understand that starting from scratch is VERY HARD because a modern browser has lots and lots of useful features. Starting with a clean base can pay off though.

What are your thoughts on this crazy idea? I realize that the answers would probably be subjective due to the nature of this question, but I still am curious what you think of this.

  • 2
    In theory, you can replace HTML with a lot of things, but I don't see how could one possibly hope to coerce (and this is the correct word) everybody else into caring about his own standard. – K.Steff Aug 16 '12 at 18:55
  • 2
    Compojure does some of what you are describing. Of course, it speaks "browser," just like all the other web frameworks do. – Robert Harvey Aug 16 '12 at 19:06
  • 3
  • 1
    @Martin, Microsoft started WPF from scratch. It did not take off as much as some would have hoped because it is too convoluted, but something like WPF could have replaced HTML. It did not. Also, Apple came out with Thunderbolt standard which they did start from scratch and it is going to live. If the idea is great, needed and has a decent push behind it, then it can succeed. This is probably not the case with my proposal, but I do think that there will be more and more demand for very fast browsers. – Job Aug 17 '12 at 15:23
  • 1
    Not sure how I ended up on this post but: xkcd.com/927 – MonkeyZeus Aug 18 '15 at 17:38

Browsers have one thing going for them that pretty much overwhelms all other considerations.

Market Share.

In short, you don't have to install them. They're already on the user's machine. Don't underestimate this singular benefit.

Things have gotten much better with HTML5; you can pretty much write a rich client in it, if you want to, and there are many frameworks available that make this process easier.

If you don't like the browser's native languages, you can use things like CoffeeScript and Less to clean them up. Javascript is the new machine language anyway. That's what makes things like ClojureScript work.

There are a number of tools such as Websharper that allow web development in a single language.

Not the answer you're looking for? Browse other questions tagged or ask your own question.