From c3e9f1444175604a223596a0e322cd99b10ad438 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Tue, 11 Mar 2008 21:12:10 +0000 Subject: [PATCH] split reqprov.ss to require.ss and provide.ss svn: r8952 --- collects/scheme/provide.ss | 15 +++++++++++++ collects/scheme/{reqprov.ss => require.ss} | 4 ++-- collects/scribblings/reference/syntax.scrbl | 24 +++++++++++++++------ collects/srfi/4.ss | 2 +- collects/srfi/66.ss | 2 +- 5 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 collects/scheme/provide.ss rename collects/scheme/{reqprov.ss => require.ss} (82%) diff --git a/collects/scheme/provide.ss b/collects/scheme/provide.ss new file mode 100644 index 0000000000..fe23f61825 --- /dev/null +++ b/collects/scheme/provide.ss @@ -0,0 +1,15 @@ +#lang scheme/base + +(require (for-syntax scheme/base scheme/provide-transform)) + +(provide matching-identifiers-out) +(define-syntax matching-identifiers-out + (make-provide-transformer + (lambda (stx modes) + (syntax-case stx () + [(_ rx spec) + (regexp? (syntax-e #'rx)) + (let ([rx (syntax-e #'rx)]) + (filter (lambda (e) + (regexp-match? rx (symbol->string (export-out-sym e)))) + (expand-export #'spec modes)))])))) diff --git a/collects/scheme/reqprov.ss b/collects/scheme/require.ss similarity index 82% rename from collects/scheme/reqprov.ss rename to collects/scheme/require.ss index 3bac06d6d3..45032bd987 100644 --- a/collects/scheme/reqprov.ss +++ b/collects/scheme/require.ss @@ -9,8 +9,8 @@ (syntax-case stx () [(_ rx spec) (regexp? (syntax-e #'rx)) - (let*-values ([(rx) (syntax-e #'rx)] - [(imports sources) (expand-import #'spec)]) + (let-values ([(rx) (syntax-e #'rx)] + [(imports sources) (expand-import #'spec)]) (values (filter (lambda (i) (regexp-match? rx (symbol->string diff --git a/collects/scribblings/reference/syntax.scrbl b/collects/scribblings/reference/syntax.scrbl index 3d1b255db8..2a80c8ec6b 100644 --- a/collects/scribblings/reference/syntax.scrbl +++ b/collects/scribblings/reference/syntax.scrbl @@ -1341,7 +1341,7 @@ pre-defined forms are as follows. error is reported.} @defsubform[(except-in require-spec id ...)]{ Like - @scheme[require-spec], but omitting those exports for which + @scheme[require-spec], but omitting those imports for which @scheme[id]s are the identifiers to bind; if any @scheme[id] is not in the set that @scheme[require-spec] describes, a syntax error is reported.} @@ -1715,9 +1715,9 @@ introduced at the same time. Similarly, @schemeidfont{all-defined} and its variants export only definitions accessible from the lexical context of the @scheme[phaseless-spec] form.} -@subsection{Additional @scheme[require] and @scheme[provide] Macros} +@subsection{Additional @scheme[require] Macros} -@note-lib-only[scheme/reqprov] +@note-lib-only[scheme/require] This library provides additional forms for use in @scheme[require] and @scheme[provide]. These forms provide more complex selection and @@ -1726,22 +1726,34 @@ massaging of identifiers that are useful in some cases. Note that a requiring the library itself should be a separate form. For example, use @schemeblock[ - (require scheme/reqprov) + (require scheme/require) (require (matching-identifiers-in #rx"foo" "foo.ss")) ] instead of @schemeblock[ - (require scheme/reqprov + (require scheme/require (matching-identifiers-in #rx"foo" "foo.ss")) ] @defsubform[(matching-identifiers-in regexp require-spec)]{ - Like @scheme[require-spec], but including only exports whose names + Like @scheme[require-spec], but including only imports whose names match @scheme[regexp]. @scheme[regexp] must be a literal regular expression (see @secref["regexp"]).} +@subsection{Additional @scheme[provide] Macros} + +@note-lib-only[scheme/provide] + +This library provides additional forms for use in @scheme[provide], it +mirrors the @scheme[scheme/require] library. + +@defsubform[(matching-identifiers-out regexp provide-spec)]{ + Like @scheme[provide-spec], but omitting the export of each binding + with an external name that matches @scheme[regexp]. @scheme[regexp] + must be a literal regular expression (see @secref["regexp"]).} + @;------------------------------------------------------------------------ @section[#:tag "#%top-interaction"]{Interaction Wrapper: @scheme[#%top-interaction]} diff --git a/collects/srfi/4.ss b/collects/srfi/4.ss index 068f73e7a9..a66748599b 100644 --- a/collects/srfi/4.ss +++ b/collects/srfi/4.ss @@ -1,6 +1,6 @@ #lang scheme/base -(require scheme/reqprov) +(require scheme/require) ;; Note: this also gets additional functions for srfi-66 (u8vector-copy, ;; u8vector=?, u8vector-compare, u8vector-copy!) -- but that should be fine, diff --git a/collects/srfi/66.ss b/collects/srfi/66.ss index d2241bd07c..ae5b42d0f7 100644 --- a/collects/srfi/66.ss +++ b/collects/srfi/66.ss @@ -1,5 +1,5 @@ #lang scheme/base -(require scheme/reqprov) +(require scheme/require) (require (matching-identifiers-in #px"\\bu8vector\\b" scheme/foreign)) (provide (all-from-out scheme/foreign))