MacMusic  |  PcMusic  |  440 Software  |  440 Forums  |  440TV  |  Zicos
time
Search

'Can a Programming Language Implement Time Travel?'

Saturday February 24, 2024. 05:34 PM , from Slashdot
Stack Overflow's blog reports on a new programming language called Mariposa.

They call it a 'toy' programming language, 'created as a way to play around with a novel or odd feature, like variable assignment outside of the normal order of execution — more colloquially, time travel.'

Computer science has long sought to reason about time in electronic systems, thanks to a consistent interest in concurrency and real-time messaging... Mariposa allows you to manipulate the order of execution by assigning an instant to a variable, then setting the context of that instance. Here's a basic example, taken from the Mariposa readme:

x = 1
t = now()
print(x)
at t:
x = 2


According to the normal order of operations, this code should print '1'. But because t is assigned to the instance in the second line, any modifications specified within an at t: block are applied immediately, and this code prints '2'...

While Mariposa caught a fair amount of attention recently, it's not the first implementation of time travel in programming. There is a Haskell package appropriately called tardis, which creates two state transformers: one travels forward in time and one backward. As the docs explain, 'The most concise way to explain it is this: getPast retrieves the value from the latest sendFuture, while getFuture retrieves the value from the next sendPast.' One function's past is another one's future.

The article explores 'the history and future of other programming paradigms' applying logic to time, including interval temporal logic systems as well as 'modeling, analysis, and verification languages/tools that allow temporal and state modeling without requiring temporal logic understanding.'

Read more of this story at Slashdot.
https://developers.slashdot.org/story/24/02/24/0521230/can-a-programming-language-implement-time-tra...

Related News

News copyright owned by their original publishers | Copyright © 2004 - 2024 Zicos / 440Network
Current Date
May, Thu 9 - 12:21 CEST