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

Syntax-rules should freeze the scope variables when defined #172

Open
Tracked by #43
jcubic opened this issue Aug 20, 2021 · 2 comments
Open
Tracked by #43

Syntax-rules should freeze the scope variables when defined #172

jcubic opened this issue Aug 20, 2021 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@jcubic
Copy link
Collaborator

jcubic commented Aug 20, 2021

Found another edge case:

(define-syntax g
  (syntax-rules ()
    ((g 2) -3)))

(let-syntax ((f (syntax-rules ()
                  ((f 1) (g 2)))))
  (set! g (lambda (x) -1000))
  (f 1))

It evaluates to -1000 because syntax-rules macros are expanded at runtime, but most important is that this can be easily fixed. The macro when invoked needs to collect names from env and then use it when invoked.
This is related to long-standing task #43 but it would be easier to track as a separate issue.

Things to consider the redefinition of macro a warning. The finding is based on Scheme Servey.

@jcubic jcubic added the bug Something isn't working label Aug 20, 2021
jcubic added a commit that referenced this issue Aug 20, 2021
@jcubic jcubic added this to the 1.0 milestone Jan 8, 2024
@jcubic
Copy link
Collaborator Author

jcubic commented Jan 19, 2024

This may require #169 to be added. Moving to 1.1

@jcubic jcubic modified the milestones: 1.0, 1.1 Jan 19, 2024
@jcubic
Copy link
Collaborator Author

jcubic commented Jan 25, 2024

Hygienic macros cannot expand in referentially-opaque
code: if a macro expansion introduces a free identifier,
the identifier refers to the binding occurrence which
was in effect when the macro was defined rather than
when the macro was expanded.
-- How to Write Seemingly Unhygienic andReferentially Opaque Macros withSyntax-rules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant