add something like plt's syntax-local-value
Bug #225387 reported by
Stephen Wrobleski
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ikarus Scheme |
Fix Committed
|
Wishlist
|
Abdulaziz Ghuloum |
Bug Description
Basically, I'd like to grab the value associated with a syntax binding
; mzscheme example
(define-syntax print-syntax-value
(lambda (stx)
(syntax-case stx ()
((_ id)
(identifier? #'id)
(begin
(display (syntax-local-value #'id))
(newline)
(define-syntax vv 42)
; displays 42 during expansion phase
(print-syntax-value vv)
This feature would allow macro-controlled expansion of subexpressions, and extensible macros using syntactical keywords.
Ikarus restricts syntax bindings to procedures, which is less than ideal, but this can be worked around by wrapping arbitrary values in a lambda. (Omitted in the example for clarity)
Changed in ikarus: | |
milestone: | none → 0.0.4 |
To post a comment you must log in.
On May 1, 2008, at 3:48 PM, Stephen Wrobleski wrote:
> Basically, I'd like to grab the value associated with a syntax binding
>
> ; mzscheme example
>
> (define-syntax print-syntax-value
> (lambda (stx)
> (syntax-case stx ()
> ((_ id)
> (identifier? #'id)
> (begin
> (display (syntax-local-value #'id))
> (newline)
> #'(begin))))))
>
> (define-syntax vv 42)
>
> ; displays 42 during expansion phase
> (print-syntax-value vv)
Does this only work at the top-level?
> (let ([x 3]) syntax- value x) 18/collects/ scheme/ private/ misc.ss: 68:7
(print-
12)
syntax-local-value: not defined as syntax: #<syntax::298>
=== context ===
/Applications/PLT Scheme v3.99.0.