Has there been any work on looking at the relationship between monomorphised, static polymorphism (like in C++ and Rust, etc), and staged programming? I think the interesting thing here is that instead of inlining stuff, we sort of memoize each instantiation?
Conversation
One thing I'm thinking about is that you don't always know at the time of writing the function what your caller wants to do. Do they want to monomorphise? Do they want to predictably inline it (like a macro)? Do they wan an indirect call? Do they want to let the compiler decide?
Replying to
You also have interactions with abstraction boundaries: the implementation of staged code is public to the compiler even if it isn't to the programmer. Also dynamic vs. static linking . This could be overwhelming for users, but the power to be precise about this seems useful!
1
