
Macros and other tools that need syntax privilege used `(current-code-inspector)' at the module top-level to try to capture the right code inspector at load time. It's more consistent to instead use the enclosing module's declaration-time inspector, and `var-ref->mod-decl-insp' provides that. The new function works only on references to anonymous variables, which limits access to the inspector. The real function name is longer, of course. original commit: 0197902309c5400d463393829a88282c627dafd2
24 lines
657 B
Racket
24 lines
657 B
Racket
#lang scheme/base
|
|
|
|
(require (for-syntax scheme/base
|
|
syntax/stx
|
|
syntax/kerncase
|
|
syntax/struct
|
|
racket/struct-info
|
|
scheme/include))
|
|
|
|
(provide shared)
|
|
|
|
(define-for-syntax code-insp (variable-reference->module-declaration-inspector
|
|
(#%variable-reference)))
|
|
|
|
(define undefined (letrec ([x x]) x))
|
|
(require (only-in scheme/base [cons the-cons]))
|
|
|
|
(define-syntax shared
|
|
(lambda (stx)
|
|
(define make-check-cdr #f)
|
|
;; Include the implementation.
|
|
;; See private/shared-body.rkt.
|
|
(include "private/shared-body.rkt")))
|