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

anophoric if example #4

Closed
sbloch opened this issue Jan 18, 2013 · 1 comment
Closed

anophoric if example #4

sbloch opened this issue Jan 18, 2013 · 1 comment
Assignees

Comments

@sbloch
Copy link

sbloch commented Jan 18, 2013

Working my way through this tutorial; thanks!

Section 5 ends with "But we can still define it as a normal variable" and an example of doing so. It doesn't mention that after one has defined it as a normal variable, "aif" no longer works:
syntax-parameterize: not bound as a syntax parameter in: it

I tried to fix this by putting the define-syntax-parameter in a local scope around the body of the macro definition:

(define-syntax aif
(local ((define-syntax-parameter it ; etc.))
(lambda (stx)
(syntax-case ; etc.))))

but apparently define-syntax-parameter doesn't count as a "definition" for local's purposes. And I suspect that if it were defined only locally, it wouldn't serve the intended purpose anyway.

@ghost ghost assigned greghendershott Jan 20, 2013
@greghendershott
Copy link
Owner

Thanks for catching this. What I should have written is that it can still be defined locally. At the top level top level that you can't redefine it.

;; Although we can't redefine `it` at the top level -- that would conflict
;; with the syntax parameter -- we can still define `it` in a local context.

;; For example:

(let ([it "hi"])
  it)

(define (foo)
  (define it "hi")
  it)

I'll update Scribble and push to the web site, when I have a bit more time, then mark this as closed. Thanks again!

greghendershott pushed a commit that referenced this issue Jan 20, 2013
* master:
  Regen HTML.
  Update copyright years.
  Fix #4: Clarify attempt to define syntax param id as normal var.
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

2 participants