[plt-scheme] Re: Bug in PLT Scheme 204's SRFI 19 implementation?

From: Dirk Gerrits (dirk at gerrits.homeip.net)
Date: Tue Aug 12 13:31:52 EDT 2003

Dirk Gerrits wrote:
>
> I think there may be a bug in the SRFI 19 implementation that comes with 
> PLT Scheme 204. In this piece of code, date->string works fine, but 
> string->date doesn't:
> 
>  > (require (lib "time.ss" "srfi" "19"))
>  > (define date-format "~a ~b ~d ~H:~M:~S ~Y")
>  > (define now (date->string (current-date) date-format))
>  > now
> "Wed Aug 06 18:01:40 2003"
>  > (string->date now date-format)
> . . string=?: expects type <string> as 2nd argument, given: sun; other 
> arguments were: "Wed"
> 
> It seems that the lookup vectors (like tm:locale-abbr-weekday-vector) 
> consist of symbols instead of strings. But if I change those symbols 
> into capitalized strings, string->date works but date->string breaks. So 
> the problem must lay deeper, but I don't yet understand the code well 
> enough.

I've now installed PLT Scheme v205, but it doesn't fix my problem. I've 
changed all references to string=? in time.ss to string-hack=?

(define (string-hack=? x y)
   (string-ci=? (if (symbol? x) (symbol->string x) x)
                (if (symbol? y) (symbol->string y) y)))

which seems to do the trick, but of course it's just a hack.

PLT people?

Dirk Gerrits




Posted on the users mailing list.