Mind is getting blown by multi-stage programming! Does anyone know of any simple examples of it being used as a way of doing offline partial evaluation in compilation? Most of the stuff I see is for run-time code generation. 🤔
Conversation
Is there any inherent difference between "online" and "offline" techniques; rather than just whether you choose to have it run before or after you ship the software?
(I was going to ask if you're familiar with LMS, and link cs.purdue.edu/homes/rompf/pa, but seems that's "online".)
1
Replying to
Yeah I've seen LMS before, and it looks really interesting! "On Cross-Stage Persistence in Multi-Stage Programming" seems to suggest there is: fos.kuis.kyoto-u.ac.jp/~igarashi/pape
"MetaOCaml is not very suitable for writing offline generators because of CSP [Cross-Stage Persistence]. Our type system introduces residualizable code types to solve the problem."
1
Haven't yet understood this claim, and the pros and cons. Would also really love to see some example implementations of compilers that do offline partial evaluation using this kind of thing (but that might be hoping for too much).
1
1
Show replies

