Surreal FOREVER loop

From Esolang
Jump to navigation Jump to search

A Surreal FOREVER loop is an esoteric language construct that allows an infinite loop to be completed. Technically, it's certainly impossible in any Turing-complete language (you would need to solve the Halting Problem), but it's a nice idea.


The Surreal Forever Loop is a loop that executes code infinitely many times in a finite period of time. It accomplishes this by analyzing the code provide and calculating what happens if you repeat it ad infinitum. This is, of course, impossible (what if the loop is calculating if a given Turing Machine has halted at a particular step? If you were to repeat that infinitely many times, it would be able to calculate what happens with the TM in the end- whether or not its halted (if it has, it halts at some point. If not, it never halts, thus solving the Halting Problem)). However, it may be possible for some restricted subset of Turing Machines or some other automaton- preferably, one which a TM can solve the halting problem for. Alas, these automata probably aren't particularly useful for mainstream programming.

See Also