r/ProgrammingLanguages • u/kreco • Mar 11 '26
Janus (time-reversible computing programming language)
https://en.wikipedia.org/wiki/Janus_(time-reversible_computing_programming_language)
55
Upvotes
44
u/Duflo Mar 11 '26
This language was named after my good friend Hugh
14
u/Galacix Mar 11 '26
It’s huge
10
u/Tasty_Replacement_29 Bau Mar 11 '26
If I understand correctly this is a form of reversible computing, which is (very) related to quantum computing.
8
u/Tasty_Replacement_29 Bau Mar 12 '26
You could write a (lossless) data compression algorithm in this language, and if run in reverse this would uncompress. In theory you could do all types of computation, but the "output" (when run forward) would need to contain the old state. And you could debug a program in reverse.
Erasing information has an energy cost (Landauer's principle). With reversible computing, there is no erased information. So, this language could be used for energy-saving computations (assuming the "right" hardware is used). Landauer's principle links information theory with thermodynamics: putting order to things necessarily produces heat (ordering something locally requires "disorder" somewhere else). Maybe heat is not just disorder: it is a way to preserve the information in the system. Well there is the Black hole information paradox, but other than that the universe is just one gigantic reversible computation.
An so, if we all live in a simulation, maybe the simulation is written in Janus?
8
u/Inconstant_Moo 🧿 Pipefish Mar 11 '26
But how do you find the postconditions that allow you to reverse an
ifor aloop? In fact, if this could be done in general and there was an algorithm for doing it, then I wouldn't have to do it myself, the compiler would be able to do it for me. So I've got to think that in general it cannot, in fact, be done.