[plt-scheme] flawed syntax definition of require in slibinit

From: Andreas Voegele (voegelas at gmx.net)
Date: Sun Mar 30 12:03:20 EST 2003

I'd like to use SLIB's database functions but I get an error when I
try to load the database module.

 > (require 'databases)
 init.ss:361:6: mz:require: not at top-level or in module body in: (mz:require type)

There are two functions in slib/dbutil.scm that require a feature in
the following way:

 (define (create-database filename type)
   (require type)
   ...)

Here's an example call:

 (create-database "/tmp/mydata" 'alist-table).

The problem is caused by the following code in slibinit/init.ss.  It
seems that the situation outlined above is not handled.

 (define-syntax (require stx)
   (syntax-case stx (quote)
     [_
      (identifier? stx)
      #'slib:require]
     [(_ (quote something))
      #'(slib:require (quote something))]
     [(_ req ...)
      #'(mz:require req ...)]))

Wouldn't it be better to make slib:require the default case and to
check for mz:require instead?

Or maybe an expression that is evaluated at run time could be used
instead of a syntax definition.

I fixed the problem by redefining require, but IMHO slibinit/init.ss
ought to be fixed.  Unfortunately, I'm not experienced enough to
provide a patch.

Regards,

Andreas



Posted on the users mailing list.