3 ms·
It's possible to make JavaScript not be Turing-complete. You could place a limit on the number of instructions the program could execute, or a limit on the amou
by simonster 15y ago
It's possible to make JavaScript not be Turing-complete. You could place a limit on the number of instructions the program could execute, or a limit on the amount of memory (including network transfers), either of which would make it mathematically possible to determine whether or not the program halts.
However, this doesn't mean it's feasible, and if the language is useful it's probably not. You can pick an NP-complete problem with a large input data set and make halting depend upon the outcome. It will take a very long time to determine if such an application halts or not, since you have to solve the NP-complete problem.
Of course, if you care only about states the application could potentially reach, instead of those it actually does reach, you could do this much faster. However, if you know which states are undesirable, you can check if you are reaching them during runtime as well.