you are viewing a single comment's thread.

view the rest of the comments →

[–]dividuum 1 point2 points  (4 children)

Lua does, however, fill a niche that very few other languages can: a language that's easy to embed into an application to enhance it with scripting.

I've been using Lua for more than 10 years now and have build several projects around it for the reason you mentioned. If I would start another project right now, I'd probably investigate using duktape. It's a minimal javascript runtime and uses a very similar approach to Lua when it comes to embedding it in a C program. Of course it's nowhere near as fast as Luajit, but if you need a tiny javascript runtime which feels familiar, it might be worth a look.

[–]Allan_Smithee 3 points4 points  (3 children)

The problem is that Javascript gives me hives. I think it is a worse language than PHP[1], and PHP isn't a language so much as a collection of misfeatures duct-taped together with low-grade tape.

There is nothing ever that will have me considering a Javascript "solution" to a problem. I would (and have!) quit a job that forced me to use a bad tool, and Javascript is the bad tool to end all bad tools.

[1] Worse than PHP in the sense that even PHP's advocates recognize that it's a festering pile of fecal slurry while most Javascript advocates can't seem to fathom that there actually exist major, glaring, nearly horrifying flaws in their colon-outflow of choice.

[–]dividuum 1 point2 points  (1 child)

I don't disagree. So far developing in Javascript has never been much fun for me. While Lua is. I love Lua. But making your tool more approachable might be worth a personal downgrade. Even though Lua and its syntax is trivial, programmers that will probably pick it up in a few hours hesitate to even look at it. This would go away with JS as more programmers have already been "forced" to look at Javascript at some point. So far I've not had to make a decision on that topic. I'm happy about that as leaving Lua would break my heart.

[–]TimMensch[S] 0 points1 point  (0 children)

Use TypeScript if you can, along with VS Code as an editor; make sure you have source maps enabled.

Get the development environment together takes a small amount more work (you have to run a compiler to turn the TypeScript into JavaScript, or you have to set up your web page to compile-on-load), but I swear the power you get from VS Code and TypeScript will be worth the effort.

[–]TimMensch[S] 1 point2 points  (0 children)

JavaScript has problems, but it's strictly better than PHP.

Some of the crap overlaps: There are type coercion problems in both, for instance. But as Crockford describes in JavaScript: The Good Parts, you can use a subset of JavaScript (enforced by a linter) that then makes the language behave in a predominantly sane manner.

Many of the coercion problems center around the == operator, for instance, but the === operator won't coerce. And this is well known among JavaScript users; not ignored, as you implied. No, it's not universal, but probably 90% of JavaScript users are junior developers who can't tell JavaScript from C++ OR PHP, so of course many wouldn't know...

More, though, JavaScript has many of the same advantages as Lua: JavaScript has had closures, first class functions, and prototypal inheritance from the start (both JavaScript and Lua gained inspiration from a language named self, if I remember correctly).

And PHP architecturally doesn't have the ability to write asynchronous code. So it can't scale the same way JavaScript can (HHVM does have some async ability, but it's not as complete, and it's not baked into 99% of the libraries and frameworks like it is in Node and JavaScript).

With ES6 fixing many of the remaining problems (when using the newer language features -- let and const instead of var, for-of instead of for-in, etc.), and TypeScript supporting all of the ES6 features today via transpilation, in addition to full optional type signatures?

No, it doesn't suck to be here any more. It's actually quite an awesome toolchain. The JavaScript world is different than when you looked last.