3 ms·
Within a single codebase, it's not too big a deal. You can add a new clause to each switch statement, pattern-match statement, or visitor class. The compile err
by skybrian 6y ago
Within a single codebase, it's not too big a deal. You can add a new clause to each switch statement, pattern-match statement, or visitor class. The compile errors tell you what you need to do. Compile-time checking is good, right?
The issue gets stickier when you have a public API and can't make the upgrade in a single patch. What happens if one library defines an AST for a language, there are unknown downstream dependencies that define language tools for various purposes, and you want to change the language to add a new AST node type?
It seems fairly clear that you are revving the language and any tools you have need to be modified to handle the new language construct. They will work fine on v1 of the language but they don't know how to handle v2. This may be a backward-compatible change for programs, but it isn't for tools. They need to handle any possible program, so they need to upgrade or they will break for v2 programs.
But, do we want a lack of v2 support to be a compile error when building the tools? All the tools should work fine with v1. It's only for v2 code that we need the change.
It seems like for smooth migration you need to support multiple, similar versions of the language at the same time. v1 and v2 should be defined simultaneously and tools updated incrementally to support v2.
This gets to be a burden when you are changing the language a lot, though.
- dllthomas 6y agoNot a complete solution, but hugely relevant: https://www.microsoft.com/en-us/research/uploads/prod/2016/11/trees-that-grow.pdf https://www.microsoft.com/en-us/research/uploads/prod/2016/1...