For now. I get the feeling that soon enough a lot of them will start dying out. Trying to "sell" some language other than JS in a mostly-JS shop is already an impossible battle. Popularity is used as a counter-argument for everything.
I was just thinking that the Javascript community saw that the Ruby community were both snobs and well respected, assumed a causal link, and thought they just needed to be snobs for people to respect Javascript.
Better javascript would be incompatible with javascript - best you can get will be "less sucking javascript". And you'll be able to use it somewhere in the far future, after four competing companies have implemented enough of it in a way that mostly works, their browsers have reached most of the internet and the brave open source community has developed the polyfills needed to fix the incompatibilities.
I'm not holding my breath. Javascript sucks, it will be everywhere and we are stuck with it.
I'm totally with you. JS is such a bad language, might get better in the future with ES<X> but I guess not. It has many quick hacks (in the bad sense), admitted by it's author.
Interesting pattern I see lately is industry pundits on the CIO side advocate Javascript for inhouse tooling. I guess they have not much experience with programming languages.
With JS making inroads into CIO territory, we'll see a much higher usage in the future. And a much larger fallout with tons of unmaintainable legacy code.
It's like the times when everything needed Java, like Oracle added Java into their DBs for stored procedures. I guess Oracle will add JS too (or have they already?).
By better choices you mean better languages or other methods of achieving the same flexibility without the complexity of a language like JS? Can you reply with examples? I am interested in alternatives to JS and LUA.
Well, it's a popularity contest. Lua is certainly a great language, it's fast and it works well with C. I guess that nginx team thinks that js will bring more users therefore more business. If I were to develop a product and add a scriptable layer, i'd certainly use JavaScript. Even if it is not the best language out there, it's about growing an ecosystem.
Isn't Node more of an Application server though? I don't see Node replacing Nginx in the roles it's normally used for (serving static resources, reverse-proxy). I can't think of a single upside
Agreed... I don't want the effort and complexity it would take to offer a lot of what's pretty easy with nginx inside a node app. As much as I really like node, I think it's generally nginx in front of node to offset what it does better... I think people make applications complicated enough as it is...
I like and use both. I think Lua is a better language and I have a hard time seeing otherwise. Lua has some warts too, it's not about warts, but Lua got enough right from the beginning, is small enough to be crazy fast, and is not continually adding new large features. This is the key thing to me. JavaScript is designed by committee and has too many features in ES6.
I have been playing around with Lua in Openresty for the last few nights. I haven't had any Lua experience before but it seems to be a good language for Nginx, and it has been fun to learn.
Last I checked Javascript implementations were slower than LuaJIT. Cost of implementing Lua tables, meta-tables, co-routines, etc. in Javascript will be rather high. Anywhere between 2-50x. If native Lua engine is removed, you can just forget about it then.
So what you're saying doesn't make any sense for anything remotely performance sensitive.
JavaScript objects are indexed by strings. Lua tables are indexed by arbitrary objects. In JS a[1] and a["1"] are the same element but they are different in Lua. In Lua a[{}] is a new element indexed by the identity of the new object literal, and will be a different element every time the expression is evaluated.
So many better choices out there.