On Fri, 20 Feb 2009, Larry Wall wrote:

Duration and Instant are both simple (but typed) Num semantics
on seconds.  There are no integers unless you specifically ask for
an interpretation in minutes, hours, fortnights, what have you.
The basic flow of time is continuous and stable in Perl 6, or as
continuous and stable as we can make it.

Hence our ideal timeline will be strict atomic time in TAI, and
machines that don't have access to the current atomic time will have
to approximate it as best they can.  They're already broken anyway,
in my opinion.

Only atomic time in atomic seconds will be futureproof over the long
haul.  All other interpretations are negotiable via libraries, but
time must be considered a position on a real timeline, and seconds
are a reasonable unit for measuring that timeline.  The method in
$duration.seconds should not have to do any calculations to return
the Num number of seconds, because whether we're talking about
gigaseconds or femtoseconds, we're still talking about seconds.

Time has no relationship to integers apart from cultural artifacts.
Let's keep our integers in the libraries, not in the fundamental
definition of what "now" and "then" mean.

As long as there's no attempt to provide math beyond "add this many seconds to this many seconds", it's probably safe. That will make it clear that there's no way to calculate "one month from today" using the core API.

What I'm really trying to avoid is something like the Perl 5 Time::Seconds & Time::Piece combo, where the former defines a constant of ONE_MONTH so you can do:

  my $time = Time::Piece->new( ... )
  $time += ONE_MONTH;

But since ONE_MONTH is defined in terms of seconds, this is completely broken.

Of course, if you're dealing with TAI only, you're safe for constants up to ONE_WEEK.


http://VegGuide.org               http://blog.urth.org
Your guide to all that's veg      House Absolute(ly Pointless)

Reply via email to