Can’t require pollen/setup for syntax
#229
Closed
opened 5 years ago by otherjoel
·
10 comments
Loading…
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
pollen.rkt
: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/setup
is loaded, it needs to resolve certain values by looking insidepollen.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 referencessetup:poly-targets
.)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 mypollen.rkt
setup module, I would start getting errors aboutpdf-tagname
being 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'pdf
insetup:poly-targets
?When I reset to commit
67c0c95422
(beforepollen/setup
became more strict) and run thispollen.rkt
: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.rkt
that depend onpollen/setup
in 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 mysetup
module, or define it in two separate places and keep them in sync manually.Right: you could define
poly-targets
in an external file, let’s say"exts.rkt"
: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
compiled
directories 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
compiled
directories which has fixed it.Thank you!