News for hackers. Stuff that matters.
Re:Surprisingly Turing-Complete by lmm on Friday October 02, 2015 @03:33PM (#10320730)
I don't favour anything that puts more Javascript out there, but I agree with the more general point: if you're going to embed a programming language, better to embed a real, well-designed one than an ad-hoc custom one.

This is also why I find the likes of drools and cucumber utterly wrongheaded. (More generally, there's an antipattern of turing-complete configuration files - often when an organization has convinced itself that "code" needs to go through a long testing and deployment cycle but "configuration" doesn't). If you already have a programming language, use it.

Re:Surprisingly Turing-Complete by twic on Sunday October 04, 2015 @08:09AM (#10327306)
Drools yes, but Cucumber? Cucumber isn't a programming language, it's just a sequence of steps. There's no logic, iteration, calling, etc. There's substitution of table values into steps, but that's no more programming than a mail merge.
Re:Surprisingly Turing-Complete by lmm on Sunday October 04, 2015 @05:12PM (#10328845)
Tests end up needing logic, and so Cucumber ends up splitting the flow of a test between two files in different languages.

I should probably have complained about HTML templating that allows a template to call into functions (or have logic in it itself), that's a bigger and clearer example of the problem.

I think the underlying principle here is that the more powerful languages need to be outermost. Having a powerful language call into a weak language to do something that needs to happen safely works well. Having a weak language call into a powerful language just results in a worst of both worlds - all of the danger but less of the power.

Re:Surprisingly Turing-Complete by simoncion on Friday October 02, 2015 @09:31PM (#10322248)
How do you feel about Lua?
Re:Surprisingly Turing-Complete by lmm on Saturday October 03, 2015 @06:45AM (#10323389)
By the accidents of history I've never actually used it. I've used TCL and Python in similar "embed in C" cases (which worked pretty well); these days I'm mostly on the JVM.