I'm not sure why, but this works:
(unit
(import foo^)
(export bar^)
(+ foo bar)))
while this fails:
(define-syntax-rule (asyn body ...)
(unit
(import foo^)
(export bar^)
body ...))
(asyn (+ foo bar))
with the error "unit: undefined export" for any imported variables.
Your example is similar to
(define-syntax-rule (with-x body)
(let ([x 5])
body))
(with-x x) ; => unbound identifier
That is, `import` is a binding form, just like `let`. Bindings
introduced by a hygienic macro do not capture identifiers at the
macro-use site.
If you want non-hygienic
While pointing students at teachpacks for HtDP/2e, one of our tutors correctly
pointed out that they're not documented using HtDP signatures, but using
standard Racket contracts. For instance, in big-bang's docs:
> (to-draw render-expr)
> render-expr: (-> WorldState scene?)
> But now that looked at the pollen docs, I see the issue. It looks like
> you have to be able to run the config submodule of some program to be
> able to figure out how to syntax color it
I'm making progress with your suggested technique but hitting a dead end inside
DrRacket.
Here's what I've
> Anyway, In DrRacket, files are not always saved before they are run so
> you cannot reliably get a path. In general, the source name of a
> syntax object or the object-name of a port doesn't have to be anything
> in particular and the source location of the file is generally only
> available
I don't want to lay claim to suggesting this technique as I am not
sure it is a good idea. I mean to be explaining that, not suggesting
you use it in my earlier message. :)
In particular, it means that if you put a syntax error (or malicious
code) into the pollen config then you will crash
On Saturday, November 28, 2015 at 11:24:28 PM UTC, Matthew Flatt wrote:
> That is, `import` is a binding form, just like `let`.
Oh, that makes sense. So it gets swapped in the macro for a hygenic named
variable, and the ones I pass by that name don't get swapped in the same
fashion, thus aren't
7 matches
Mail list logo