Hacker News new | ask | show | jobs
by outworlder 2306 days ago
> These things started to change in the early 2000. So deeply ingrained with the disgust for JavaScript, that it took a very long time for the consensus to emerge that you could actually build very complex software on a post-V8 runtime.

I wonder how history would have looked like if Scheme had been used instead, as was the original intention.

Or perhaps, Lua.

3 comments

To be honest, I was using JavaScript for years as an OOP language before I actually understood how I could use JavaScript as a functional language.

However, I don't think the limitation was the language. The biggest limitation really were bug ridden browsers. Trying to get something to work across all browsers was incredibly challenging because so many basic features simply didn't work.

Had the syntax been based on scheme, my guess is scheme's reputation would have suffered. I think people have a tendency to blame the thing that they understand the least, so I could see people blaming scheme for the browser's failings.

Also, I went to a university that taught SICP and I'm sorry to say it wasn't popular. Again, when things didn't work, there was a tendency to blame the thing that was least understood.

I could see a Lua-like syntax being approachable, but even that wouldn't have helped. Again, the biggest problem with JavaScript was being tethered to buggy browsers that often failed when you asked them to do simple things.

Then everyone would hate scheme now :-) The primary problems with JavaScript was browser incompatibilities and bugs, mostly related to the DOM, and a limited standard library. Using a different language syntax wouldn't have alleviated those problems.

But I like the idea of angle brackets for content and parentheses for script.

Much better if it had gone with Scheme
With scheme perhaps, but the Lua of 1995 was a much more primitive language which didn't even support closures. It had the opportunity to break backwards compatibility and refine itself numerous times - as the defacto language of the web I think lua would have turned out much poorer rather than the web much better.
Lua is pretty terrible in how barebones it is. I don't think anyone on HN who raves about Lua yet complains about JS has done much work with either.

There's a reason it has zero traction beyond embedded application and niche application like Pico8.

That which Lua is missing is primarily in terms of its ability to define clear, succinct algorithms. And in this respect the more Algol-derived languages enjoy a substantial advantage by having readily available tools for the task. Tables are a semantic compromise compared to list, array and map primitives, and the standard library assumes little, making it hard to write "native" Lua without encountering a need for R&D on some dependency.

But when it works in its true intended domain, gluing together and applying configuration to structured APIs and data, it's about as good as it gets, having had the benefit of major revision. And that makes it a stable computing platform, even more stable than the Lisp family(which are like BASIC in that it's quite easy to make an incompatible one). As a side effect, that also makes it an excellent source-to-source target.

But to put it another way: Everyone says they like minimalism until they try to live in it. Everyone who needs minimalism knows its limitations and makes exceptions.

That's exactly what makes Lua and JS directly comparable - they're both barebones, when it comes to stdlib.

But as far as the language itself goes, Lua is far superior, with a lot more consistency all around, and fewer traps.

Something like TCL would be far better. Or Inferno.