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

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Fri Jan 11 21:35:50 EST 2013

On Fri, Jan 11, 2013 at 8:13 PM, Asumu Takikawa <asumu at ccs.neu.edu> wrote:

> 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?
>
>
(The diff shows all of the tests changing). Are the tests for exported
functions? If so, that sound bad.


> 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.
>
>
Was the mutation exposed via the library?


> 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).
>
>
That sounds like a backwards incompatible change (in that some programs
that could use srfi/19 would get #f out of selectors that now get something
else).

Could a srfi/19 date be a union of two structs, where one represented a
time only?

Robby
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20130111/cc6867b3/attachment.html>

Posted on the dev mailing list.