[racket-dev] racket/date, SRFI-19, date construction

From: Asumu Takikawa (asumu at ccs.neu.edu)
Date: Fri Jan 11 13:04:06 EST 2013

Hi all,

I had a few design questions about date types as used in the racket/date
and srfi/19 libraries.

First, for some reason racket/date and srfi/19 use mutually incompatible
date representations and this is noted in the documentation (so it's
intentional). Is there a good reason for this? As far as I can tell, it
should be technically do-able to make srfi/19 use `date*` (for
nanoseconds) and thus be compatible with racket/date functions.

Second, the date structure used by racket/date has some seemingly
extraneous fields. For example, `week-day` and `year-day` can be
calculated from the rest of the fields and aren't necessary (this is
annoying if you want to construct your own dates manually).

Changing the structure is clearly a non-solution, but how about
exporting a different `make-date` constructor that makes `week-day`,
`year-day`, `dst?`, and `time-zone-offset` optional and default to
something sensible?

Note: in the long run, it's probably best to have a comprehensive
srfi/19 replacement in racket/date, but in the meantime it'd be nice to
have a stopgap measure.

Cheers,
Asumu

Posted on the dev mailing list.