Documented make-module-like-named-scope, specified module for that binding and make-named-scope

This commit is contained in:
Georges Dupéron 2017-04-24 22:58:07 +02:00
parent 115c056061
commit ed1fbcbaaa
2 changed files with 13 additions and 2 deletions

View File

@ -74,6 +74,8 @@
@section{Hack for named scopes} @section{Hack for named scopes}
@defmodule[debug-scopes/named-scopes/exptime]
Module scopes bear are annotated by Racket with the name of the module. As of Module scopes bear are annotated by Racket with the name of the module. As of
December 2016, other scopes like macro scopes@note{Both the ones implicitly December 2016, other scopes like macro scopes@note{Both the ones implicitly
created when a macro is called, and the ones explicitly created via created when a macro is called, and the ones explicitly created via
@ -87,7 +89,16 @@ any form of annotation or naming.
implementation mechanism may vary in future versions, for example if later implementation mechanism may vary in future versions, for example if later
versions of Racket directly support the creation of named scopes, versions of Racket directly support the creation of named scopes,
@racket[make-named-scope] would simply become an alias for the official @racket[make-named-scope] would simply become an alias for the official
mechanism.} mechanism. Later versions of this function may therefore produce named scopes
other than module-like scopes.}
@defproc[(make-module-like-named-scope [name (or/c string? symbol?)])
(->* (syntax?) ([or/c 'add 'remove 'flip]) syntax?)]{
Produces a named module-like scope. The @racket[make-named-scope] function
currently also produces a module-like scope, so the two are equivalent for now.
In later versions, @racket[make-named-scope] may produce other sorts of named
scopes if they can be created more efficiently, but
@racket[make-module-like-named-scope] will always produce module-like scopes.}
@define[orig:define-syntax @racket[define-syntax]] @define[orig:define-syntax @racket[define-syntax]]
@define[orig:syntax-local-introduce @racket[syntax-local-introduce]] @define[orig:syntax-local-introduce @racket[syntax-local-introduce]]

View File

@ -19,7 +19,7 @@
(string-join (map ~a (cdr (vector->list (cddr s)))) (string-join (map ~a (cdr (vector->list (cddr s))))
" "))) " ")))
scopes)) scopes))
(define max-len (apply max (map string-length l))) (define max-len (apply max 0 (map string-length l)))
(define (pad str) (define (pad str)
(string-append (string-append
str str