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

From: Ray Racine (ray.racine at gmail.com)
Date: Fri Jan 11 13:47:10 EST 2013

FWIW I did some sort of port of SRFI/19 to Typed Racket.  I recall doing
something along the lines of bridging the impedance mismatch between Racket
and the SRFI, but whatever it was, was minimal.  I was in a hurry.  If
anyone is interested.

- date.rkt was a standard TR require/typed wrapping of srfi-19

https://github.com/RayRacine/racketlib/blob/master/prelude/type/date.rkt<https://github.com/RayRacine/racketlib/blob/master/prelude/type/datetime.rkt>

- datetime.rkt was intended to be a reasonable update of srfi-19 as a
standard TR module based on Racket idioms, native apis.   I did just enough
to get those functions I needed and that was it.  One thing I do recall is
the that Leap Second table in srfi-19 was somewhat out of date.

https://github.com/RayRacine/racketlib/blob/master/prelude/type/datetime.rkt


Ray


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

> 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
> _________________________
>   Racket Developers list:
>   http://lists.racket-lang.org/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20130111/e44d353e/attachment.html>

Posted on the dev mailing list.