[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: proposed getitimer and setitimer functions

From: Thomas Bushnell, BSG
Subject: Re: proposed getitimer and setitimer functions
Date: 06 Jul 2001 17:51:31 -0700
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Marius Vollmer <address@hidden> writes:

> What about collapsing the "secs" and "microsecs" value into one, with
> a unit of microseconds.  With bignums, we don't need to use long-hand
> for multi-word numbers.

A "time" is no more a number than is a "character".  It's conventional
to *represent* them as numbers, but that's irrelevant.  One of the
glories of Scheme (and really a Lisps) is that it treats characters as
first class objects, not as some kind of cheap number.

Similarly should be times.  A time might have a "zero point" (the
so-called epoch) but this is a convention of representation and not a
matter of the time itself.  (Time, unlike temperature, has no natural
zero point.)

Times are not just differently scaled than numbers.  They also have
other special properties.

For example, a key attribute of (human) times is radical differences
in representation.  There are a gajillion calendrical systems, which
include not just the differences between Gregorian and Julian, and all
the others that Emacs calendar mode knows about (Islamic, French
Revolutionary, Maya, Coptic, etc., etc.)--there are also all those
time zones to think of!  Some of which change (like where I live) that
twice every year.

We don't yet have systems for dealing with relativistic time
variances.  But someday, we may well might.

Converting between times and these various "external representations"
is a crucial thing.

Also, times have absolute precision.  A given internal representation
of time might have limited precision, but the time itself is a pure
number which (in our current physical theories) can take on a dense
set of values and not some discrete (limited precision) set.

So what does this mean?  It means the right way to implement times in
Scheme (and therefore Guile) is:

A time is an abstract "moment".  It has some internal representation,
just as do real numbers.  Indeed, its representation can be exact or
inexact, just as for numbers.  Unlike numbers, it might well be useful
to also keep track of its "precision"; or maybe not.

Times can be converted to various external representations, according
to the rules for various calendrical systems.  It's no business of the
user what the internal representation looks like (any more than for
characters).  There does need to be some time->number and number->time
bijection, to provide an unambiguous read syntax, if nothing else.

So I think Marius is on the right track, but didn't go far enough.  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]