change #:module-info to #:language-info for consistency with module->language-info

This commit is contained in:
Matthew Flatt 2010-04-21 18:50:16 -06:00
parent 895ca49f9c
commit 7503f8c6e9
16 changed files with 66 additions and 70 deletions

View File

@ -1,7 +1,7 @@
#lang scheme/base
(provide module-info)
(provide get-info)
(define ((module-info options) key default)
(define ((get-info options) key default)
(case key
[(configure-runtime) `(#(htdp/bsl/runtime configure ,options))]
[else default]))

View File

@ -12,7 +12,7 @@
#:read (wrap-reader read options)
#:read-syntax (wrap-reader read-syntax options)
#:info (make-info options)
#:module-info (make-module-info options)
#:language-info (make-language-info options)
(define options opts)))
@ -36,5 +36,5 @@
[else (use-default key default)]))
(define (make-module-info options)
`#(htdp/bsl/module-info module-info ,options))
(define (make-language-info options)
`#(htdp/bsl/language-info get-info ,options))

View File

@ -1,5 +1,4 @@
#lang s-exp syntax/module-reader
racket/base
#:info get-info
(require racket/private/get-info)
#:language-info '#(racket/language-info get-info #f)

View File

@ -1,6 +1,4 @@
#lang s-exp syntax/module-reader
racket
#:module-info '#(racket/private/get-info get-info #f)
#:language-info '#(racket/language-info get-info #f)

View File

@ -1,4 +1,4 @@
(module get-info "pre-base.ss"
(module language-info "private/pre-base.ss"
(provide get-info)
@ -6,6 +6,6 @@
(lambda (key default)
(case key
[(configure-runtime)
'(#(racket/private/runtime configure #f))]
'(#(racket/runtime-config configure #f))]
[else default]))))

View File

@ -1,7 +1,4 @@
#lang s-exp syntax/module-reader
racket/private/pre-base
#:info get-info
#:module-info '#(racket/private/get-info get-info #f)
(require racket/private/get-info)
#:language-info '#(racket/language-info get-info #f)

View File

@ -1,9 +0,0 @@
#lang scheme/base
(provide configure)
(define (configure config)
(current-prompt-read (lambda ()
(printf "> ")
(read)))
(print-as-quasiquote #t))

View File

@ -0,0 +1,10 @@
(module runtime-config '#%kernel
(#%provide configure)
(define-values (configure)
(lambda (config)
(current-prompt-read (lambda ()
(printf "> ")
(read)))
(print-as-quasiquote #t))))

View File

@ -7,18 +7,18 @@
#%module-begin)
scribble-base-info
scribble-base-reader-info
scribble-base-module-info)
scribble-base-language-info)
(define-syntax-rule (module-begin lang #:wrapper1 wrapper1)
(#%reader-module-begin
lang
#:read scribble:read-inside
#:read-syntax scribble:read-syntax-inside
#:read scribble:read-inside
#:read-syntax scribble:read-syntax-inside
#:whole-body-readers? #t
#:wrapper1 wrapper1
#:info (scribble-base-info)
#:module-info (scribble-base-module-info)))
#:wrapper1 wrapper1
#:info (scribble-base-info)
#:language-info (scribble-base-language-info)))
;; Settings that apply just to the surface syntax:
(define (scribble-base-reader-info)
@ -36,6 +36,5 @@
(dynamic-require 'scribble/tools/drscheme-buttons 'drscheme-buttons)]
[else ((scribble-base-reader-info) key defval default)])))
(define (scribble-base-module-info)
(lambda (modpath data)
#f))
(define (scribble-base-language-info)
'#(racket/language-info get-info #f))

View File

@ -6,11 +6,11 @@ scribble/lp/lang/lang
#:read-syntax read-syntax-inside
#:whole-body-readers? #t
#:info (scribble-base-info)
#:module-info (scribble-base-module-info)
#:language-info (scribble-base-language-info)
(require scribble/reader
(only-in scribble/base/reader
scribble-base-info
scribble-base-module-info))
scribble-base-language-info))

View File

@ -1,2 +1,4 @@
#lang s-exp syntax/module-reader
slideshow
#:language-info '#(racket/language-info get-info #f)

View File

@ -41,7 +41,7 @@
[#:wrapper2 ~wrapper2 #'#f]
[#:whole-body-readers? ~whole-body-readers? #'#f]
[#:info ~info #'#f]
[#:module-info ~module-get-info #'#f]
[#:language-info ~module-get-info #'#f]
[(when (equal? (and lang #t) (and ~lang #t))
(err (string-append
"must specify either a module language, or #:language"

View File

@ -33,7 +33,7 @@ language, though it may also be @scheme[require]d to get
(code:line #:wrapper2 wrapper2-expr)
(code:line #:language lang-expr)
(code:line #:info info-expr)
(code:line #:module-info module-info-expr)])
(code:line #:language-info language-info-expr)])
#:contracts ([read-expr (input-port? . -> . any/c)]
[read-syntax-expr (any/c input-port? . -> . any/c)]
[whole-expr any/c]
@ -185,41 +185,41 @@ identifiers used by the @scheme[reader-option]s.
function) currently just returns the default for
@scheme['color-lexer].}
@item{@scheme[#:module-info] specifies an implementation of
@item{@scheme[#:language-info] specifies an implementation of
reflective information that is used by external tools to
manipulate the @emph{compiled} form of modules in the language
@scheme[_something]. For example, when MzScheme starts a
program, it uses information attached to the compiled main
module to initialize the run-time environment.
manipulate the @emph{compiled} or @emph{declared} form of
modules in the language @scheme[_something]. For example, when
MzScheme starts a program, it uses information attached to the
compiled main module to initialize the run-time environment.
Since the compiled form exists at a different time than when
the source is read, a @scheme[#:module-info] specification is a
vector that indicates an implementation of the reflective
information, instead of a direct implementation as a function
like @scheme[#:info]. The first element of the vector is a
module path, the second is a symbol corresponding to a function
exported from the module, and the last element is a value to be
passed to the function. The last value in the vector must be
one that can be written with @scheme[write] and read back with
@scheme[read]. When the exported function indicated by the
first two vector elements is called with the value from the
last vector element, the result should be a function or two
arguments: a symbol and a default value. The symbol and default
value are used as for the @scheme[#:info] function (but without
an extra default-filtering function).
Since the compiled/declared form exists at a different time
than when the source is read, a @scheme[#:language-info]
specification is a vector that indicates an implementation of
the reflective information, instead of a direct implementation
as a function like @scheme[#:info]. The first element of the
vector is a module path, the second is a symbol corresponding
to a function exported from the module, and the last element is
a value to be passed to the function. The last value in the
vector must be one that can be written with @scheme[write] and
read back with @scheme[read]. When the exported function
indicated by the first two vector elements is called with the
value from the last vector element, the result should be a
function or two arguments: a symbol and a default value. The
symbol and default value are used as for the @scheme[#:info]
function (but without an extra default-filtering function).
The value specified by @scheme[#:module-info] is attached to
The value specified by @scheme[#:language-info] is attached to
the @scheme[module] form that is parsed from source through the
@scheme['module-language] syntax property. See @scheme[module]
for more information.
The expression after @scheme[#:module-info] is placed into a
The expression after @scheme[#:language-info] is placed into a
context where @scheme[language-module] are
@scheme[language-data] are bound, the same as for
@scheme[#:info].
In the case of the MzScheme run-time configuration example,
MzScheme uses the @scheme[#:module-info] vector to obtain a
MzScheme uses the @scheme[#:language-info] vector to obtain a
function, and then it passes @scheme['configure-runtime] to the
function to obtain information about configuring the runtime
environment. See also @secref[#:doc refman "configure-runtime"].}

View File

@ -1,10 +1,10 @@
#lang scheme/base
(require typed-scheme/typed-reader)
(provide module-info configure)
(provide get-info configure)
(define ((module-info arg) key default)
(define ((get-info arg) key default)
(case key
[(configure-runtime) `(#(typed-scheme/module-info configure ()))]
[(configure-runtime) `(#(typed-scheme/language-info configure ()))]
[else default]))
;; options currently always empty

View File

@ -5,14 +5,14 @@ typed/scheme/base
#:read r:read
#:read-syntax r:read-syntax
#:info make-info
#:module-info make-module-info
#:language-info make-language-info
(define (make-info key default use-default)
(case key
[else (use-default key default)]))
(define make-module-info
`#(typed-scheme/module-info module-info ()))
(define make-language-info
`#(typed-scheme/language-info get-info ()))
(require (prefix-in r: typed-scheme/typed-reader))

View File

@ -5,14 +5,14 @@ typed/scheme
#:read r:read
#:read-syntax r:read-syntax
#:info make-info
#:module-info make-module-info
#:language-info make-language-info
(define (make-info key default use-default)
(case key
[else (use-default key default)]))
(define make-module-info
`#(typed-scheme/module-info module-info ()))
(define make-language-info
`#(typed-scheme/language-info get-info ()))
(require (prefix-in r: typed-scheme/typed-reader))