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

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

On 2013-01-11 15:39:08 -0600, Robby Findler wrote:
>    I think it would be great if you were to find backwards-compatible
>    ways to bring these two a little bit closer. Making them use the
>    same internal date struct, for example, would be a great thing.

I wrote a patch to make both of these use the same structure, attached
to the e-mail. It seems to pass all of the srfi-19 and date tests (with
some tests changed where appropriate). Does it look alright?

It turns out there was one (sort of) good reason for SRFI-19 to define
its own struct type: it used mutation for several functions. Racket's
date/date* are immutable. I just changed these to use functional update.

Another thing: when a string is converted to a date, it's possible that
the format string only has time-of-day but no date specification.
Previously, this produced a srfi/19 date with '#t's but I've now
defaulted it to the start day of the Unix epoch (arbitrarily).


Posted on the dev mailing list.