mflatt: looks like the kernel error is that resolve-module-path-index returns '#%kernel
rather than ''#%kernel
but that violates the return contract
IRC bridge is down again
@jeapostrophe '#%kernel
seems like a fit for the contract of resolve-module-path-index
, which promises to return a path or a symbol or an encoding of a submodule reference; possibly, you want module-path-index-resolve
, or maybe you want to use collapse-module-path-index
mflatt: collapse-module-path-index
solves the #%kernel problem, but not the way to figure out what self
is
Normally, you’d do that with variable-reference->module-path-index
, but I don’t see a way to use that for a require transfomer
Or does the single-argument form of collapse-module-path-index
work in this case?
Or maybe you’re looking for (module-path-index-join #f #f)
as the “self” index
I just updated the example and I get collapse-m-p-i to violate its own contract — https://gist.github.com/jeapostrophe/ab3e1837bf6c7627fe3b07555ba49bea
i’ll try the self idea
ya, i don’t know how to make variable-reference->module-path-index useful
I think the contract of collapse-module-path-index
with a single argument will have to be changed to allow a #f
result if the given module path index is a “self” index. You can work around the bug by checking specifically for that before calling collapse-module-path-index
it turns out that I can also pass in the thunk to lookup self and throw an error there
no idea on how to get self though? (thinking ahead: suppose I could, I assume that make-import
will fail if it tries to import from itself?)
I assume it’s clear what this transformer does? I’m pretty happy with it generally
Right - it makes no sense for a module to import from itself, and it’s not expressible as an import
struct
No, I haven’t yet tried to figure out what the transformer does
Ah, if you look down at the example, (default-in m [id def])
imports id
from m
if m
provides it OR it binds id
to def
right now it works assuming that def
is actually imported from somewhere
but it would be nice if it didn’t have to be and could be locally defined
(remix makes its so that when you require a module m
, you automatically put (m:#%required)
in your module, so it can mess with your environment)
You can use syntax-local-lift-module-end-declaration
during a require transformer, if that helps
I just tried that :) for some reason I thought that wasn’t allowed
Thanks!
I’ll just change collapse-...
’s contract to allow #f
I’ll push a repair soon
Ok, I’ll wait
(will need to rebuild, since I’m days behind)
np
@aisis has joined the channel