Skip to content

Latest commit

 

History

History
131 lines (104 loc) · 5.1 KB

time.pod

File metadata and controls

131 lines (104 loc) · 5.1 KB

NAME [TODO] Time RFC

07:02 <mberends> masak: after we conque^H^H^H^H^H^Hfinish our projects,
                        we should re-implement time.
07:03 <masak> mberends: I agree. I have a local git repo with some
                        early timespace implementations.
07:03         mberends: but they're in Perl 7.

DESCRIPTION This document missed the April 2001 Perl 6 RFC deadline, self referentially confirming the need for more effective time control. Perl 6 took some steps in the right direction, such as Junction and Temporal. Experience with those helped round out this proposal.

Unfortunately most of the proposed design can be written only in pseudocode, because Perl 6 does not distinguish real time, actual time etc.

MOTIVATION A surprisingly high proportion of application code (and CPAN libraries) grapples with aspects of time, and many parts are mutually incompatible. Here are the problems often mentioned online:

Singleton Whatever modules are used, the basic assumption is just one time scale. Just like single threading, it's a narrow way to regard time. No meaningful .new() or array of timescales are available. If parallel universes can be imagined, surely multiple timescales are trivial.

1-D Newtonian time is basically all we imagine and use. Rather like the tape in a Turing Machine, but worse because you can only go forwards and have almost no control of the speed. Bidirectional and 2-D are high priorities for the next generation time system.

Nonrepeatable Even with unidirectional 1-D time, a proper .clone() for time that works like fork() would permit repeatable and fake restartable execution. The movie Groundhog Day showed some real world use cases. Of course current cryptography would not withstand parallel time attacks, and would also need to be redesigned.

Brave New World We can turn the apparent negatives listed above into positives about the proposed new specification.

Time::Real In Perl 5 and 6 Time::Real was the best approach, but shortcomings such as unidirectionality and overlooking relativistic effects are disappointing. The following design extends this prior approach.

OS support for realtime applications is improving. Even the Windows 7 scheduler could act as host if the kernel stopped virtualizing hours, minutes and seconds.

Time::Absolute The proposed name Time::Absolute indicates that this will be the One True Way to handle time. The One True Way to measure time is from the Big Bang, in units of electron orbits around a hydrogen nucleus at absolute zero. We are currently around 4.2E27 on that scale, beyond 64 bit precision but well under the 128 bit barrier. Time::Absolute is not a class name like Time::Real because Perl 6 classes, for example, cannot do predictive algebra. Perl 7 will provide the necessary language constructs.

Time::Relative Mainly to support backward compatibility, Time::Relative can also correct dilation associated with acceleration, dark matter etc. Parameterized instances of Relative Time can emulate legacy time scales, such as ephemeris time, UTC, the Unix epoch, and even Mayan, Gregorian and Julian calendars.

FUNCTIONS

time In all versions up to Perl 6, calling time() in scalar context returned a value in Unix time. Fair enough, but Absolute Time obsoletes that and should become the default return type in 128 bits. Casting Absolute Time to Int will convert to Unix time.

METHODS

this The expression this time is syntactic sugar for Time::Absolute.this().

next The expression next time is syntactic sugar for Time::Absolute.next().

was The expression time was creates a Junction contrasting Time::Absolute.now() and Time::Absolute.previous().

all for all time creates an infinite loop. Unlike while True that can can be conditionally terminated from within, for all time stops only when the hardware running it is destroyed.

flies The expression time flies appends an extra comment to a previous comment, to the effect that the writer of time flies had been unaware of the interval between an earlier referenced event and thesse comments, but has become aware of its magnitude.

reverse This depends on unimplemented hardware support. As with quantum computing, we can define how the software should behave in anticipation of an eventual device. Recursively applying the maxim Built It And They Will Come, a computer equipped with time control will be able cause its own invention and bootstrap the implementation, as long as is has Purpose. Therefore the present lack of hardware is not a major blocker. In fact a large investment to refine Purpose in this design might lead to a huge technological advance.

class Time "class" fails to express the full power of Time. The requirements were A better construct is definitely needed, perhaps something to consider in Perl 7.

has @.tuit; Developers frequently complain about a lack of tuits.

JIT These ugly patches just obstruct the imponly hinder the

SEE ALSO