[plt-scheme] R6RS fixes and an interoperability question

From: Andreas Rottmann (a.rottmann at gmx.at)
Date: Mon Sep 28 15:11:32 EDT 2009


I'm working on getting my R6RS libraries running on PLT Scheme once
again, and have prepared two patches fixing issues in PLT's R6RS

1) rnrs/arithmetic/fixnums-6 partly assumes 32-bit fixnums:

Welcome to MzScheme v4.2.2.1 [3m], Copyright (c) 2004-2009 PLT Scheme Inc.
> (require rnrs/arithmetic/fixnums-6)
> (fxarithmetic-shift 1 31)
fxarithmetic-shift: expected argument of type <exact integer in [-30, 30]>; given 31
> (fixnum-width)

According to R6RS 11.2 Fixnums, this behaviour is wrong, as 31 is
certainly less than `(fixnum-width)' on this system. The following patch
get's rid of the hardcoded value 30 in that library:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: plt-rnrs-fixnums.patch
Type: text/x-diff
Size: 4402 bytes
Desc: Don't hardcode a 30-bit limit for fixnum width bounds	checking
URL: <http://lists.racket-lang.org/users/archive/attachments/20090928/1a348a48/attachment.bin>
-------------- next part --------------

2) There's a typo in "collects/rnrs/io/ports-6.ss":

-------------- next part --------------
A non-text attachment was scrubbed...
Name: plt-rnrs-io-ports-typo.patch
Type: text/x-diff
Size: 580 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20090928/1a348a48/attachment-0001.bin>
-------------- next part --------------

I'm working on a patch to fix the mutable pairs issue in at least some
SRFIs, I've attached what I've got so far -- please note that this is
only /very/ lightly tested. For SRFI-1, I've taken the implementation
from Derick Eddington's R6RS SRFI collection[0], as it doesn't make
sense to wrap the pristine PLT SRFI-1 implementation; for SRFI-8 I've
likewise created an R6RS library, for SRFI-13 and SRFI-14, I've re-used
the pristine implementations and inserted conversions from/to mutable
lists in the relevant places:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: plt-r6rs-srfi.patch.gz
Type: application/octet-stream
Size: 17538 bytes
Desc: An attempt at fixing SRFIs 1, 8, 13 and 14 for	R6RS/SRFI-97
URL: <http://lists.racket-lang.org/users/archive/attachments/20090928/1a348a48/attachment.obj>
-------------- next part --------------

Finally, I have an interoperability question: I'd like to interface R6RS
ports with PLT's `subprocess' procedure, and AFAICT, there is no way to
get at the underlying native PLT port given an R6RS port. I'm willing to
implement support for this, but am unsure about how to proceed. What I
thought would work is moving code in "collects/rnrs/io/ports-6.ss" to
"collects/r6rs/private/ports.ss", and add a procedure named
e.g. `r6rs-port->port'. Then "collects/rnrs/io/ports-6.ss" would just
re-export all of "collects/r6rs/private/ports.ss" except for the added
non-standard procedure. Does that make sense?

[0] https://code.launchpad.net/~scheme-libraries-team/scheme-libraries/srfi

Regards, Rotty
Andreas Rottmann -- <http://rotty.yi.org/>

Posted on the users mailing list.