HACKER Q&A
📣 prisenco

If an existing language had browser support, which is the best fit?


For now, Javascript remains king of the web client.

Sure we have WASM on the horizon but too much needs to be worked out before we can say that Javascript is no longer necessary.

But what if all the browser developers come to an agreement to natively support another language as a first class citizen.

Which language would get your vote?


  👤 beardyw Accepted Answer ✓
I don't think WASM will get access to the DOM. That makes it a kind of extension as things stand, unless I've missed something. A lot of work has gone into limiting the reach of JavaScript. That would need to be done all over again.

👤 leed25d
Lisp. It is possible to write a tiny Lisp interpreter. With its macro support, Lisp is infinitely malleable and can be extended as required.

I have often wondered why Javascript was so widely used instead of Lisp to begin with.


👤 solardev
I don't think WASM can replace JS directly (not in its current implementation, anyway) because it can't directly modify the DOM. You can outsource calculations to it, but you still need JS to handle user interactions and UI changes.

Personally, I wish we had more of a .NET style model, with a unified runtime that different languages can "compile" to. People who like a Basic-style language can use that, others can use C#, etc.

As a web dev, I don't dislike JS as much as I dislike the DOM. It's in the very name: the DOCUMENT Object Model. But so many modern web apps aren't documents anymore. Even a word processor like GDocs isn't a document. HTML makes sense only for a very specialized type of UI: things resembling articles or blog posts. It's a poor fit for anything else, requiring a lot of CSS to get something as simple as basic responsiveness working.

I wish we had a proper cross-platform UI markup language instead, something that can read and edited by humans directly but is also simple for higher-level languages to directly manipulate. It can be XML based (lke JSX) or something entirely different, I don't care, but it should have a good standard library for common interactions (e.g. validate this form, try to send this API request up to X times, parallelize these requests) and a good set of UI primitives, not just a simple


👤 wryoak
Tcl. I would love to use Tcl for manipulating the DOM.

👤 elviejo79
Smalltalk, then each tab would be its own image (vm). Web Apps would be a natural derivation of tje VM.