From f6a190d3f3ba79b55491478355b700f3e6899b99 Mon Sep 17 00:00:00 2001 From: Carl Eastlund Date: Sun, 30 May 2010 12:43:01 -0400 Subject: [PATCH] Moved unstable/cce/require-provide to unstable/require. --- collects/unstable/cce/planet.ss | 2 +- collects/unstable/cce/reference/manual.scrbl | 1 - collects/unstable/cce/reference/planet.scrbl | 2 +- .../unstable/cce/reference/scribble.scrbl | 2 +- collects/unstable/cce/test/checks.ss | 2 +- collects/unstable/cce/test/test-main.ss | 2 - .../unstable/cce/test/test-require-provide.ss | 9 ----- .../{cce/require-provide.ss => require.rkt} | 36 ++---------------- .../require.scrbl} | 37 ++++--------------- collects/unstable/scribblings/unstable.scrbl | 1 + 10 files changed, 16 insertions(+), 78 deletions(-) delete mode 100644 collects/unstable/cce/test/test-require-provide.ss rename collects/unstable/{cce/require-provide.ss => require.rkt} (74%) rename collects/unstable/{cce/reference/require-provide.scrbl => scribblings/require.scrbl} (60%) diff --git a/collects/unstable/cce/planet.ss b/collects/unstable/cce/planet.ss index 89343056e9..f78305f39a 100644 --- a/collects/unstable/cce/planet.ss +++ b/collects/unstable/cce/planet.ss @@ -2,7 +2,7 @@ (require (for-syntax unstable/planet-syntax) unstable/planet-syntax - "require-provide.ss") + unstable/require) (define-syntax (this-package-version-symbol stx) (syntax-case stx () diff --git a/collects/unstable/cce/reference/manual.scrbl b/collects/unstable/cce/reference/manual.scrbl index a32608753a..b3de258322 100644 --- a/collects/unstable/cce/reference/manual.scrbl +++ b/collects/unstable/cce/reference/manual.scrbl @@ -12,7 +12,6 @@ @include-section["set.scrbl"] -@include-section["require-provide.scrbl"] @include-section["planet.scrbl"] @include-section["debug.scrbl"] diff --git a/collects/unstable/cce/reference/planet.scrbl b/collects/unstable/cce/reference/planet.scrbl index e88410e2f4..d114119396 100644 --- a/collects/unstable/cce/reference/planet.scrbl +++ b/collects/unstable/cce/reference/planet.scrbl @@ -12,7 +12,7 @@ This module provides tools relating to @|PLaneT| packages. In addition to the binding described below, it provides @scheme[define-planet-package] and -@scheme[this-package-in] from @schememodname[unstable/cce/require-provide], and +@scheme[this-package-in] from @schememodname[unstable/require], and @scheme[make-planet-path], @scheme[syntax-source-planet-package], @scheme[syntax-source-planet-package-owner], @scheme[syntax-source-planet-package-name], diff --git a/collects/unstable/cce/reference/scribble.scrbl b/collects/unstable/cce/reference/scribble.scrbl index d0ab93ff19..3e1597841b 100644 --- a/collects/unstable/cce/reference/scribble.scrbl +++ b/collects/unstable/cce/reference/scribble.scrbl @@ -13,7 +13,7 @@ This module provides tools for Scribble documentation; specifically, of @|PLaneT| packages. In addition to the bindings described below, this module provides @scheme[this-package-version-symbol] from @schememodname[unstable/cce/planet], @scheme[this-package-in] from -@schememodname[unstable/cce/require-provide], and +@schememodname[unstable/require], and @scheme[make-scribble-evaluator] and @scheme[make-scribble-module-evaluator] from @schememodname[unstable/sandbox]. diff --git a/collects/unstable/cce/test/checks.ss b/collects/unstable/cce/test/checks.ss index 89d9ceb9e3..63e0fdf79e 100644 --- a/collects/unstable/cce/test/checks.ss +++ b/collects/unstable/cce/test/checks.ss @@ -2,7 +2,7 @@ (require scheme/pretty srfi/67 - "../require-provide.ss") + unstable/require) (require/provide schemeunit schemeunit/text-ui) diff --git a/collects/unstable/cce/test/test-main.ss b/collects/unstable/cce/test/test-main.ss index f1a34592a9..03c2968cdc 100644 --- a/collects/unstable/cce/test/test-main.ss +++ b/collects/unstable/cce/test/test-main.ss @@ -3,7 +3,6 @@ (require "checks.ss" "test-debug.ss" "test-planet.ss" - "test-require-provide.ss" "test-scribble.ss" "test-set.ss") @@ -11,6 +10,5 @@ (test-suite "scheme.plt" debug-suite planet-suite - require-provide-suite scribble-suite set-suite)) diff --git a/collects/unstable/cce/test/test-require-provide.ss b/collects/unstable/cce/test/test-require-provide.ss deleted file mode 100644 index 2cd37ab7a2..0000000000 --- a/collects/unstable/cce/test/test-require-provide.ss +++ /dev/null @@ -1,9 +0,0 @@ -#lang scheme - -(require "checks.ss" - "../require-provide.ss") - -(provide require-provide-suite) - -(define require-provide-suite - (test-suite "require-provide.ss")) diff --git a/collects/unstable/cce/require-provide.ss b/collects/unstable/require.rkt similarity index 74% rename from collects/unstable/cce/require-provide.ss rename to collects/unstable/require.rkt index 6f3b986ffd..ea536f96c2 100644 --- a/collects/unstable/cce/require-provide.ss +++ b/collects/unstable/require.rkt @@ -1,8 +1,8 @@ -#lang scheme +#lang racket -(require (for-syntax scheme/match - scheme/require-transform - scheme/provide-transform +(require (for-syntax racket/match + racket/require-transform + racket/provide-transform syntax/parse unstable/planet-syntax) unstable/define) @@ -125,35 +125,7 @@ src-sym))) orig-stx)])) -;; (do-local-require rename spec ...) -;; Lifts (require spec ...) to the (module) top level, and makes the imported -;; bindings available in the current context via a renaming macro. -(define-syntax (do-local-require stx) - (syntax-parse stx - [(_ rename:id spec:expr ...) - (let*-values ([(imports sources) - (expand-import - (datum->syntax - stx - (list* #'only-meta-in 0 (syntax->list #'(spec ...))) - stx))] - [(names) (map import-local-id imports)] - [(reqd-names) - (let ([ctx (syntax-local-get-shadower (datum->syntax #f (gensym)))]) - (map (lambda (n) (datum->syntax ctx (syntax-e n) n)) names))] - [(renamed-imports) (map rename-import imports reqd-names)] - [(raw-specs) (map import->raw-require-spec renamed-imports)] - [(lifts) (map syntax-local-lift-require raw-specs reqd-names)]) - (with-syntax ([(name ...) names] - [(lifted ...) lifts]) - (syntax/loc stx (rename [name lifted] ...))))])) - -(define-syntax-rule (local-require spec ...) - (do-local-require define-renamings spec ...)) - (provide require/provide - do-local-require - local-require quote-require define-planet-package define-collection diff --git a/collects/unstable/cce/reference/require-provide.scrbl b/collects/unstable/scribblings/require.scrbl similarity index 60% rename from collects/unstable/cce/reference/require-provide.scrbl rename to collects/unstable/scribblings/require.scrbl index 1d9475fe53..be2ea41d65 100644 --- a/collects/unstable/cce/reference/require-provide.scrbl +++ b/collects/unstable/scribblings/require.scrbl @@ -1,15 +1,11 @@ -#lang scribble/doc -@(require scribble/manual - scribble/eval - "../scribble.ss" - "eval.ss") -@(require (for-label scheme unstable/cce/require-provide)) +#lang scribble/manual +@(require scribble/eval "utils.rkt" (for-label racket unstable/require)) -@title[#:style 'quiet #:tag "cce-require-provide"]{Require and Provide} +@title{Requiring Modules} -@defmodule[unstable/cce/require-provide] +@defmodule[unstable/require] -This module provides tools for managing the imports and exports of modules. +This module provides tools for importing from modules. @defform[(require/provide module-path ...)]{ @@ -27,31 +23,12 @@ Re-exports all bindings provided by each @scheme[module-path]. Equivalent to: Produces the names exported by the @scheme[require-spec]s as a list of symbols. @examples[ -#:eval (evaluator 'unstable/cce/require-provide) -(quote-require scheme/bool scheme/function) +#:eval (eval/require 'unstable/require) +(quote-require racket/bool racket/function) ] } -@defform[(local-require require-spec ...)]{ - -This form performs a require into a local definition context. It achieves this -by lifting a @scheme[#%require] form to the top level and introducing the -bindings locally with rename transformers. For many purposes this is the same -as a regular @scheme[require]; however, only bindings for the current phase are -made available, and all names are introduced as syntax bindings even if the -exported identifiers included value bindings. - -} - -@defform[(do-local-require rename require-spec ...)]{ - -This form generalizes @scheme[do-local-require] to use an arbitrary macro -@scheme[rename] (of the same syntactic form as @scheme[define-renamings]) to -introduce local bindings. - -} - @defform[(define-planet-package name package)]{ Defines a shortcut @scheme[name] for importing modules from planet package diff --git a/collects/unstable/scribblings/unstable.scrbl b/collects/unstable/scribblings/unstable.scrbl index 025a92cfe0..c371790d7d 100644 --- a/collects/unstable/scribblings/unstable.scrbl +++ b/collects/unstable/scribblings/unstable.scrbl @@ -87,6 +87,7 @@ Keep documentation and tests up to date. @include-section["pretty.scrbl"] @include-section["queue.scrbl"] @include-section["regexp.scrbl"] +@include-section["require.scrbl"] @include-section["sandbox.scrbl"] @include-section["srcloc.scrbl"] @include-section["string.scrbl"]