define-runtime-path and pollen aren't cooperating properly
#202
Closed
opened 6 years ago by rfindler
·
11 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?
This program:
prints the path
..../pollen/private/x
instead of the path to where the file is saved.The problem seems to be that
define-runtime-path
relies onsyntax-source-module
, which is not pointing at the original source file. Do you know how to adjust this value? For instance, one can adjust the result ofsyntax-source
by usingsyntax/loc
. Butsyntax/loc
doesn’t seem to affectsyntax-source-module
.@AlexKnauth asked the same question on
racket-users
, though it went unanswered.The confusing part is probably that
syntax-source-module
is based on scopes (or "lexical context" in the docs), not source location... because it seemed like that might be a good idea back whendefine-runtime-path
was defined.So, the answer to @AlexKnauth's question is
and I'll post that to the list.
Thanks, though that helps me see that my issue involves one more degree of complexity. My macro receives a list of syntax objects at the top level of a module and I don’t know which (if any) are
define-runtime-path
. Of course,define-runtime-path
can only be at the top level of a module, so I suppose I could riffle through the list and apply this fix. That seems hacky — are there other forms likedefine-runtime-path
that also need to be adjusted? — though if it’s necessary, I won’t worry about it.Does your module-begin macro change the "lexical context" to be from some file in the
pollen/private/
directory instead of the file they came from?Oh:
(replace-context #'here #'EXPRS)
014807df58/pollen/private/main-base.rkt (L38)
Yeah, I was futzing with that line and I still couldn’t make it work. But in the words of @mflatt, “It's probably just a matter of trying harder.”
Is there a reason the
EXPRS
are changed to the context ofhere
, instead of certain other statements/bindings changed fromhere
tostx
or something?Tried harder.
Thanks!
That was a fun one to watch