[plt-dev] require with multiple forms

From: Sam TH (samth at ccs.neu.edu)
Date: Tue Mar 10 19:01:15 EDT 2009

Right now, (require A B C) expands all of A, B, and C before requiring
any of them.  This means that if the `foo' collection provides the
`foo-in' require transformer, this doesn't work:

(require foo (foo-in bar))

Instead, you have to write this:

(require foo)
(require (foo-in bar))

The following patch changes (require A ...) to be (begin (require A)
...), so that the first example should now work, which I would find
significantly more convenient.

If there aren't objections, I'll write some tests and commit this.
-- 
sam th
samth at ccs.neu.edu

Index: collects/scheme/private/reqprov.ss
===================================================================
--- collects/scheme/private/reqprov.ss	(revision 14026)
+++ collects/scheme/private/reqprov.ss	(working copy)
@@ -317,12 +317,12 @@
                                (syntax->list #'(elem ...))))]
                   [_ (transform-simple in 0 #| run phase |#)]))])
       (syntax-case stx ()
+        [(_ in)
+         (with-syntax ([(new-in ...) (transform-one #'in)])
+           (syntax/loc stx
+             (#%require new-in ...)))]
         [(_ in ...)
-         (with-syntax ([(new-in ...)
-                        (apply append
-                               (map transform-one (syntax->list #'(in ...))))])
-           (syntax/loc stx
-             (#%require new-in ...)))])))
+         (syntax/loc stx (begin (require in) ...))])))

   ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   ;; require transformers


Posted on the dev mailing list.