Conversation

Does staged programming correspond to something like a ‘later’ modality? I'm wondering if you could flip things around, and use an ‘earlier’ modality to get something that looks a bit more like `constexpr`/`const fn`/`comptime` in C++, D, Rust, Zig, etc… 🤔
4
15
Replying to
I use that 'later' point of view. The reason it fits is that you can't access the future until it actually happens. So once something is "code", it's opaque to you now. That helps motivate why abstract-interpretation-influenced annotations matter a lot.
1
3
Accessing the past from 'now' is also possible, if the past cooperates and leaves enough information around. [Type erasure is the exact opposite of that.]
1
4
Show replies
Replying to
I suspect this'd correspond to monadic ('later') vs. comonadic ('earlier') modalities. Neel Krishnaswami & co. had a paper on a comonadic modality for purity in an impure language (I think you've seen it?), maybe something like that? Dunno if it'd work out for staging.
1
1
Show replies
Replying to
`comptime` and `constexpr`, to their sound & side-effect-free extent, are just a different flavor of `Code`. It's two equivalent presentations of 2LTT, one with explicit lifting and one with implicit lifting and restricted eliminators.
1
3
I guess as a programmer it seems like an interesting change in perspective/ergonomics, where you are saying “this is computed before the code I am currently writing”. And yeah, you can't inspect the code of that stuff you are depending on, because it has already run… I think?
1
Show replies