Hacker News new | ask | show | jobs
by mmariani 5025 days ago
Kudos for the effort, but it won't fly.

Writing everything in JS isn't gonna make it better all of a sudden, even if it's sanitized JS. HTML and CSS are fine for the jobs they do which is data description and layout.

The problem is JS itself. Specifically, the lack of opinionated language design infers on code. Then we end up having to reinvent the wheel all over again, and again. And we all know how productive that can be.

We have two options here. Writing in yet another language and compiling to JS or writing a JS framework that works around its flaws. I vote for the latter.

2 comments

I think it could totally fly with a language with good declarative support. Why learn separate syntax (html, css) when all you need is some declarative semantics?

Clojure has this sort of thing and any other homoiconic language gets it for free.

Thanks, that is my thinking: learning three separate languages is a big burden, especially on beginners.
You would need to know them a bit at least - for debugging.
Thanks for your honest feedback.

Would you mind explaining what you mean by "the lack of opinionated language design infers on code"? Are you referring to the fact that it's not specialised for either layout or presentation?

No. Javascript is just a general purpose language. It could very well serve as a DSL for layout or presentation. But the browsers already have that, it's called HTML and CSS.

What I'm referring to is Javascript syntax. It's way too ambiguous which often leeds to programming errors. For instance: the global variables gaffe, the scope mess, the sloppy prototypal implementation, etc.

Hiding that behind a compiler doesn't make the problems go away. It makes them worse.

For what it's worth, my intention is to overcome some of those issues that you mention. First, I assume you're talking about accidental pollution of the global scope (by omitting 'var'), which can be avoided: see CoffeeScript. Also, I have some ideas to improve the 'scope mess', as well as prototypes.