imiT a Time Traveling Programming Language
imiT focuses on parallel timelines. At any moment, you can send a variable back in time to change aspects of the past and create a new timeline with different results.
You can destroy variables permanently, but if you send another variable back in time to stop the variable responsible for the destruction, you can prevent that. This leads to confusion with a constantly changing source code and the easy risk of creating a paradox or a time loop.
Keep in mind, the timeline doesn’t reset when you go back. Any changes made before will stay until you go back even further to prevent them.
This is just a small hobby project more than anything else. I thought it would be fun to see how it works as an experiment. If anyone finds it interesting, that would be awesome
github link:
https://github.com/nimrag-b/emiT-C
Code Example
Imagine you create a variable and print its value.
create x = 10;
print x; // prints 10
Then later, you might want to change that result.
So you create a new variable and send it back to a specific point in time.
create x = 10;
time point;
print x; //prints 10 in the first timeline, and 20 in the next
create traveler = 20;
traveler warps point{
x = traveler;
};
Now you’ve gone back in time and created a new timeline where x is 20 because of the traveler.
But there’s a catch. Two variables can’t exist at the same time. So in the second timeline, where the traveler is already there when we try to create it, a paradox occurs, collapsing the timeline. In this scenario, there are no more code executions after the traveler is created, but in more complex cases, it will immediately destroy the timeline. So unfortunately, the traveler has to eliminate itself to keep the timeline intact.
create x = 10;
time point;
print x; //prints 10 in the first timeline, and 20 in the next
create traveler = 20;
traveler warps point{
x = traveler;
traveler kills traveler;
};
Of course, the traveler can eliminate any variable, not just itself.
create x = 10;
time point;
print x; //prints 10 in the first timeline, and nothing in the next, since x is dead.
create traveler;
traveler warps point{
traveler kills x;
traveler kills traveler;
};
The last issue is this tends to create a time loop, since there’s nothing preventing the traveler from being created and sent back in time with each timeline. The solution is straightforward: just check if x is alive before creating the traveler.
create x = 10;
time point;
print x; //prints 10 in the first timeline, and nothing in the next, since x is dead.
if(x is alive)
{
create traveler;
traveler warps point{
traveler kills x;
traveler kills traveler;
};
}
Now we have a program that runs through two timelines and exits without creating a paradox or time loop.
While this is happening, every timeline created is still active. As soon as the current timeline collapses, either due to a paradox or simply reaching the end of its instructions, it jumps back to the last active timeline, and continues until every timeline has collapsed.
@Shawn
If you implement the plot of Primer (2004) like this I will gladly buy you a coffee.
Jamie said:
@Shawn
If you implement the plot of Primer (2004) like this I will gladly buy you a coffee.
Give me about a week or two to refine all the time travel mechanics properly then it’s a deal.
@Shawn
I’ll give you 10 seconds. A time traveler has no issues with deadlines.
Charlie said:
@Shawn
I’ll give you 10 seconds. A time traveler has no issues with deadlines.
A time traveler should have already met those deadlines.
Charlie said:
@Shawn
I’ll give you 10 seconds. A time traveler has no issues with deadlines.
A time traveler should have already met those deadlines.
*will have already been meeting those deadlines
Charlie said:
@Shawn
I’ll give you 10 seconds. A time traveler has no issues with deadlines.
The first deadline is the hardest. Everything after that is much easier.
@Shawn
Then do Dark But just doing time travel may not be enough, and even time travel itself might be tricky with all the determinism rules and bootstrap paradoxes! But it could illustrate the temporal path of certain characters and objects.
@Ashwin
The spaces between the spoiler indicators makes it not work on older forum systems and some apps, FYI.
Ali said:
@Ashwin
The spaces between the spoiler indicators makes it not work on older forum systems and some apps, FYI.
Thanks for the heads up, I edited it now!
@Shawn
create box;
@Shawn
I’ll cover the cost of the second coffee.
@Shawn
nice
@Shawn
If you could make a compiler for a quantum computer, we could finally do quantum bogosort for real!
@Shawn
I think you should add this example to your readme!
Whitney said:
@Shawn
I think you should add this example to your readme!
I have a folder with several example scripts in the git repo, but including one in the readme itself might be a good idea haha.
@Shawn
Does or will imiT handle the grandfather paradox? This feature seems very important.
Indy said:
@Shawn
Does or will imiT handle the grandfather paradox? This feature seems very important.
Not yet. Or maybe it always has? Or never will? Either way, I’m pretty sure at this moment in the timeline it isn’t supported, but when I remind myself to include it later, I’m confident it’ll be added.