www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit b8001667d68a1d2e38c4655c453cfa051f89404b
parent 8013bf16557942a2d02e8d2de1c29be6bee85a9b
Author: William J. Bowman <wjb@williamjbowman.com>
Date:   Tue, 29 May 2018 15:55:31 -0400

Added example of combining debug-scopes with racket/trace

Diffstat:
Mscribblings/debug-scopes.scrbl | 22++++++++++++++++++++++
1 file changed, 22 insertions(+), 0 deletions(-)

diff --git a/scribblings/debug-scopes.scrbl b/scribblings/debug-scopes.scrbl @@ -64,6 +64,28 @@ (foo (list 123))]} +You can combine @racket[+scopes] with @racketmodname[racket/trace] to trace +scopes through expansion. +@examples[ + (require racket/trace (for-syntax racket/base racket/trace debug-scopes)) + (begin-for-syntax + (define (maybe-syntax->scoped syn?) + (if (syntax? syn?) + (+scopes syn?) + syn?)) + (current-trace-print-args + (let ([ctpa (current-trace-print-args)]) + (lambda (s l kw l2 n) + (ctpa s (map maybe-syntax->scoped l) kw l2 n)))) + (current-trace-print-results + (let ([ctpr (current-trace-print-results)]) + (lambda (s l n) + (ctpr s (map maybe-syntax->scoped l) n))))) + (trace-define-syntax let + (syntax-rules () + [(_ ([x v]) e) ((lambda (x) e) v)])) + (let ([x 5]) (let ([y 120]) y))] + @defproc[(print-full-scopes [reset? any/c #t]) void?]{ Prints the long scope id and annotation for all scopes displayed as part of preceeding calls to @racket[+scopes], as would be shown by