Can’t require pollen/setup for syntax
Closedopened 3 years ago by otherjoel · 10 comments
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Under Racket BC 7.7/Pollen 3.1.2526.1362, running this in a file saved as
Produces this error:
This used to work, and doesn’t anymore. But I actually can’t figure out why it used to work.
As with #228, I think this is another error that was formerly suppressed, now revealed. Whenever
pollen/setupis loaded, it needs to resolve certain values by looking inside
pollen.rkt. So off the top of my head, it seems like what you’re trying to do should cause an error, because indeed it is a cycle in loading.
Still — what are you trying to accomplish by doing
(require (for-syntax pollen/setup))? Maybe there’s a workaround. Or maybe the failure should be allowed in this case.
I’ve been doing this in support of a macro for defining tag functions that branch to other functions automatically depending on
current-poly-target. (The macro itself references
This is what I thought, too. The weird thing is though, I am pretty sure the macro used to work as expected: if I changed
(define poly-targets '(html))to
(define poly-targets '(html pdf))inside my
pollen.rktsetup module, I would start getting errors about
pdf-tagnamebeing an unbound identifier (because I hadn’t written those functions yet). If in older versions of Pollen there was an exception being suppressed, wouldn't it fall back on the default value and never include
When I reset to commit
pollen/setupbecame more strict) and run this
The result I get is
'(html)(the default value) not
'(html pdf txt).
It does seem in principle like you might end up having to say “you just can’t use macros in
pollen.rktthat depend on
pollen/setupin phase 1”. If that were the case, it would be a mild bummer. Maybe the workaround in this case would be just to define the list of output formats outside my
setupmodule, or define it in two separate places and keep them in sync manually.
Right: you could define
poly-targetsin an external file, let’s say
Then in your
"pollen.rkt", you could import it twice, making the value available in both places:
Thereby breaking the loading cycle.
Thanks, I will take that route!
I think this means the fourth pollen tutorial (on poly output targets) is currently broken.
When I paste that as-is into Dr Racket, it gives the defective setup submodule error.
That file shouldn’t produce an error (and doesn’t, for me). Try deleting any neighboring
compileddirectories to make sure Racket isn’t getting confused.
Hmmm, well you're right, I'm having no problem re-testing it today. I'm not sure what's changed, but it could well be that I've removed
compileddirectories which has fixed it.