Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identifiers in syntax-rules can't be shadowed by local variables #291

Closed
Tracked by #43
jcubic opened this issue Jan 26, 2024 · 0 comments
Closed
Tracked by #43

Identifiers in syntax-rules can't be shadowed by local variables #291

jcubic opened this issue Jan 26, 2024 · 0 comments

Comments

@jcubic
Copy link
Collaborator

jcubic commented Jan 26, 2024

Recent change deleted the code that checks if identifiers have values in scope. The fix was needed for SRFI-210 with identifier bind from let-values was also bind function in SRFI.

But it should not work this way according to StackOverflow it should work this way:

  1. The literal does not have a binding at the point of macro definition, and also does not have a binding at the point of macro
  2. The literal has a binding at the point of macro definition, and also has the same binding at the point of macro usage.

So there is a need to wait for #172.

This example should not work:

(define-syntax if+
  (syntax-rules (then else)
    ((_ test then expr1 else expr2) (if test expr1 expr2))))

(let ((else #f) (x 10))
  (print (if+ (even? x) then (/ x 2) else (/ (+ x 1) 2))))

But this should:

(define-syntax if+
  (syntax-rules (then else)
    ((_ test then expr1 else expr2) (if test expr1 expr2))))

(define else #f)
(let ((el_se #f) (x 10))
  (print (if+ (even? x) then (/ x 2) else (/ (+ x 1) 2))))
jcubic added a commit that referenced this issue Jan 26, 2024
@jcubic jcubic changed the title Symbols in syntax-rules can't have local variables Identifers in syntax-rules can't be shadowed by local variables Jan 26, 2024
@jcubic jcubic changed the title Identifers in syntax-rules can't be shadowed by local variables Identifiers in syntax-rules can't be shadowed by local variables Jan 26, 2024
jcubic added a commit that referenced this issue Jan 26, 2024
@jcubic jcubic closed this as completed Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant