Offtopic but programming related philosophy question. I've been following the Unison programming language a little bit, and I'm very interested in their idea of keeping a code base as a database of hash id's -> function definitions, instead of just "bags of text files" that get compiled. http://unisonweb.org/2015-06-12/editing.html
What do @Araq, and other smart programming language design people think of this idea?
Also, could something like that work with Nim using the compiler api + HCR?
I could imagine a database that stores hash -> serialized Nim AST, which can detect structured changes and then feed into the compiler api + HCR to allow similar results.
I like these ideas very much but Nim can't innovate on all fronts at the same time. I'm also a big fan of Mathematica, programming based on this silly "sequence of bytes" notion should have died a decade ago. But it didn't.
So my hope is that editors let us get further and further away from the "source code text" idea until people are comfortable with the idea that an editor is not about typing :s/.*/<p>\r&\r<\/p>/ and we can store code in a much better format.
I could imagine a database that stores hash -> serialized Nim AST, which can detect structured changes and then feed into the compiler api + HCR to allow similar results.
Sounds roughly similar to what "incremental compilation" will bring to Nim.
I like these ideas very much but Nim can't innovate on all fronts at the same time.
I did not mean to say I want this feature now. Nim's current direction is great! This post was about my day dreams :-P
Sounds roughly similar to what "incremental compilation" will bring to Nim.
I had to go back and look at the RFC for incremental compilation. It's been a while since I looked at it. That RFC is actually very close to the same ideas. As usual, you are way ahead of your time Araq :-P
The RFC focuses on using the technique as a compile speed optimization, but one of the big values the article discuses relates to the editing side of things. Things like better branch merging, and structured refactors of code.
Is it reasonable to think that some type of editor process could "hook into" the incremental compilation process (specifically modify the sqlite db entries), to achieve structured AST modifications?
Interesting hoe everthing inter related, Literally, in this PR https://github.com/nim-lang/Nim/pull/10819 I have added the implementation hashes very surprisingly very close to what described in the unison link. You can start using it in macros for versioning / incrementalizing and many others very soon.
PR is ready and waits for final review