> On Oct 15, 2017, at 08:59, David Christiansen > <da...@davidchristiansen.dk> wrote: > > What about keeping type bindings separate from program bindings as a > matter of phase? This seems to me to fit in with the Hindley-Milner > program, where types exist only at compile time only, and programs > exist at run time only.
I thought about this, too, but I’m not sure it’s the right thing to do. I admit I’ve never really tried replacing phase 0 transformer bindings with phase 1 bindings, but everyone seems to use the former instead of the latter, and I’m not even entirely sure why. What is the reason we use define-syntax + syntax-local-value instead of define-for-syntax + syntax-local-eval? I’m not sure. Maybe someone can explain that to me. Ultimately, though, that would mean that it would separate the runtime value and type namespaces, but now types and users’ phase 1 bindings would share the same namespace, which is still probably confusing and unintuitive. Maybe that’s okay? Again, I feel like I’d need to understand better why we idiomatically use phase 0 transformer bindings for these things — I don’t really get it. On a different note, I started working to apply the name mangling scheme to Hackett, and it mostly works alright. There’s just one major problem I’ve run into: types provided by #langs. I can provide a custom version of `require` that unmangles all type identifiers, but as far as I can tell, I have no way to hook into identifiers provided by a module language. This means that I can write (require hackett) and have names be unmangled and placed into the correct scope, but I can’t write (module m hackett ...) and have the types be properly imported. I’m not sure there’s a way around this with any existing technique (save potentially David’s suggestion of using the phase system). Fundamentally, even if I found a way to inject a `require` that imports identifiers from the module language, this is problematic, since additional `require`s cannot shadow those bindings, and users cannot explicitly hide them. Furthermore, while I managed to make #lang hackett insert a require that injects types into the proper scope, it doesn’t work if I use hackett as a module language instead of as a #lang (because the hack in the reader that inserts the additional require cannot work in a module language). I think that means this technique is a bit of a dead-end, unless I’m missing something significant. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.