3 ms·
What I want to see in a language would be a bunch of syntactic sugar which corresponds to a MIR like Rust's by a well-specified reduction that is likely to be c
by drostie 10y ago
What I want to see in a language would be a bunch of syntactic sugar which corresponds to a MIR like Rust's by a well-specified reduction that is likely to be consistent from build to build.
The reason that this could be really cool is that you could hypothetically hash these MIRs and store these hashes in a public database of open-source code. (You would have to include hashes of whatever functions they call/depend on, and you would have to solve foreign-function imports.)
Then you would have this cool language where modules are simply saying "here's a mapping of names to hashes in the public database," with automatic recognition of "hey, these two functions you're importing from these two modules are actually the same function, I don't need to disambiguate them." If your dependency graph isn't a tree and one of the branches can't cope with a dependency-upgrade, that's fine too -- you upgrade the dependency on the one branch only. The point is, all of your dependency-semantics are now reduced to a really straightforward reasoning about unique names.
- kibwen 10y agoWhy would you prefer to hash an intermediate representation, rather than hashing the source?
- lsaferite 10y agoMaybe two different sources compile to the same IR?
- cwzwarich 10y agoIf the IR contains file and line number info, that seems pretty unlikely.
- drostie 10y agoRight, the point would be for the hash to strip out file info, line numbers, whitespace, comments, any stylistic choices which turn out to be equivalent "under-the-hood" in some straightforward way, and probably even the bound variable names (with de Bruijn indexes).
- Ericson2314 10y agoCertain normalizations can be used to discover more sharing (e.g De Bruijn indices). Really want to "hash n cache" at all levels for best results.
- killercup 10y ago> The reason that this could be really cool is that you could hypothetically hash these MIRs and store these hashes in a public database of open-source code. Sounds similar to what Joe Armstrong described at the end of "The Mess We're In" (StrangeLoop 2014): https://www.youtube.com/watch?v=lKXe3HUG2l4 https://www.youtube.com/watch?v=lKXe3HUG2l4