Hacker News new | ask | show | jobs
by almostarockstar 1370 days ago
> - Terminating. All programs terminate.

How are you side stepping an NP-hard issue like the halting problem?

2 comments

You don't solve the halting problem. You don't introduce it in the first place by making a Turing complete language.

Datalog is terminating. Programming languages don't have to allow infinite loops and recursion. There are plenty of ways to ensure recursion is terminating, like structural recursion or only allowing recursing finite data structures.

Also, how do you make servers and embedded systems?
You wouldn't. Not every language has to be a general purpose language.
Right, but embedded systems are what I do, so a language that requires termination would not be perfect for me...
Can you give an example of why you need non-terminating semantics? Programs can still be run "forever", if they are run for each input while maintaining terminating semantics for deriving output. Abstractly the Turing machine is infinite, but in the real world input and output is almost always finite and discrete.

I guess you wouldn't be able to use it to build a machine that is supposed to display Pi or Fibinocci?

Here's a CPU that controls an automobile engine. Inputs are the position of the throttle, and the rotational position of the crankshaft. Outputs are instructions to the fuel injector and the timing of spark plugs firing.

You can terminate that program when the user turns the engine off.

Or, you can say the program should consist of "read the stored state, re-configure the fuel injectors, fire a spark plug if one is supposed to fire now, update the stored state, and terminate". You could say that it should be written that way. But when you do, you've got a bunch of cynical old embedded software people saying, "Explain to me how that is better in any way? Does it make the program easier to write? No, it doesn't. Does it make it less error prone? More reliable? No and no. Does it make it use fewer resources? Also no. So why in the world do we want to write it that way?"