Programming Languages - Compatibility
- binary compatibility: ABI, code compiled by different compilers to link together and interoperate at runtime. E.g. Swift 5 is not binary compatible with earlier versions, but future versions will be binary compatible with 5.
- source compatibility: API, old code can be compiled by the new compiler
- Cross languages: different languages that are either binary or source compatible. E.g. at source level, valid Java code is also valid Groovy code, but not valid Scala code; at binary level all JVM languages are using the same bytecode.
- Backward compatible: upgrading to a newer version of the language would not break the old code. This is not always guaranteed.
It is inevitable to introduce new features and deprecate old ones. Different languages handel this differently:
- Java has
@Deprecatedannotation for APIs that should not be used. It still compiles but will give you warnings.
- Python 3 is not backward compatible with Python 2, and that makes the adoption hard and slow. Python 3.0 was released in 2008, and only in 2020 will Python 2 reach end of life.
- clang-tidy uses
modernize-to deprecated old features in C++
use strictwill limit the usage of some old features.