| Date: Wed, 15 Aug 2007 16:06:29 -0400
 | From: "David Van Horn" <[EMAIL PROTECTED]>
 | 
 | On 8/13/07, Aubrey Jaffer <[EMAIL PROTECTED]> wrote:
 | > Can R5.97R Scheme be extended to support SRFI-63 arrays?
 | 
 | To the best of my knowledge, R5.97RS needs no extension to portably
 | define SRFI 63 as a library.

The difficulty comes not in creating the library, but in using it!
Because SRFI-63 exports `equal?', the instructions for its use must
include a caveat:

  When importing SRFI-63, `equal?' must be excepted from (rnrs base).

Come to think of it, SRFI-63 should also have redefined `assoc' and
`member'.  So if SRFI-63 (or slib/array.scm) is amended:

  When importing SRFI-63, `equal?' must be excepted from (rnrs base).
  When importing `SRFI-63 (2007 08 20)' or later, if `lists' is also
  imported, then `assoc' and `member' must be excepted from it.

And what if someone uses hashtables?

  When importing SRFI-63, `equal?' must be excepted from (rnrs base).
  When importing `SRFI-63 (2007 08 20)' or later, if `lists' is also
  imported, then `assoc' and `member' must be excepted from it.
  When importing `SRFI-63 (2007 09 25)' or later, if `hashtables' is
  also imported, then `equal-hash' must be excepted from it.

Of course, none of this makes SRFI-63's `equal?', `assoc', or `member'
visible in libraries which don't import it.  And procedures in
libraries which don't import SRFI-63 can still be passed arrays;
`equal?', `assoc', and `member' used in those libraries will not
always work correctly when passed arrays.

For instance, SLIB's base-table package (in combination with the
relational-database package) makes a relational database whose tables
are implemented as association lists.  Because the base-table package
doesn't have any code specific to arrays, it would not import SRFI-63.
Thus arrays given as keys in database operations would use (rnrs
lists) `assoc', not SRFI-63 `assoc'.

One price of the R5.97RS library system has been the sacrifice of
being able to extend existing procedures to new datatypes.

_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to