jeapostrophe
2017-6-1 16:00:15

mflatt: looks like the kernel error is that resolve-module-path-index returns '#%kernel rather than ''#%kernel


jeapostrophe
2017-6-1 16:01:07

but that violates the return contract


notjack
2017-6-1 18:19:28

IRC bridge is down again


mflatt
2017-6-1 23:15:46

@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


jeapostrophe
2017-6-2 00:59:32

mflatt: collapse-module-path-index solves the #%kernel problem, but not the way to figure out what self is


mflatt
2017-6-2 01:02:30

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


mflatt
2017-6-2 01:03:47

Or does the single-argument form of collapse-module-path-index work in this case?


mflatt
2017-6-2 01:04:18

Or maybe you’re looking for (module-path-index-join #f #f) as the “self” index


jeapostrophe
2017-6-2 01:06:40

I just updated the example and I get collapse-m-p-i to violate its own contract — https://gist.github.com/jeapostrophe/ab3e1837bf6c7627fe3b07555ba49bea


jeapostrophe
2017-6-2 01:06:52

i’ll try the self idea


jeapostrophe
2017-6-2 01:09:55

ya, i don’t know how to make variable-reference->module-path-index useful


mflatt
2017-6-2 01:20:27

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


jeapostrophe
2017-6-2 01:22:59

it turns out that I can also pass in the thunk to lookup self and throw an error there


jeapostrophe
2017-6-2 01:23:31

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?)


jeapostrophe
2017-6-2 01:24:33

I assume it’s clear what this transformer does? I’m pretty happy with it generally


mflatt
2017-6-2 01:24:38

Right - it makes no sense for a module to import from itself, and it’s not expressible as an import struct


mflatt
2017-6-2 01:25:00

No, I haven’t yet tried to figure out what the transformer does


jeapostrophe
2017-6-2 01:25:35

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


jeapostrophe
2017-6-2 01:25:55

right now it works assuming that def is actually imported from somewhere


jeapostrophe
2017-6-2 01:26:11

but it would be nice if it didn’t have to be and could be locally defined


jeapostrophe
2017-6-2 01:29:14

(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)


mflatt
2017-6-2 01:32:31

You can use syntax-local-lift-module-end-declaration during a require transformer, if that helps


jeapostrophe
2017-6-2 01:33:09

I just tried that :) for some reason I thought that wasn’t allowed


jeapostrophe
2017-6-2 01:33:14

Thanks!


jeapostrophe
2017-6-2 01:35:11

I’ll just change collapse-...’s contract to allow #f


mflatt
2017-6-2 01:35:50

I’ll push a repair soon


jeapostrophe
2017-6-2 01:36:04

Ok, I’ll wait


mflatt
2017-6-2 01:36:06

(will need to rebuild, since I’m days behind)


jeapostrophe
2017-6-2 01:36:15

np


aisis
2017-6-2 02:55:15

@aisis has joined the channel