3 ms·
Solidity (a PL in which Ethereum's so called "smart contracts"[1] are developed) has version pragmas [2] at the top of each file. That's necessary b/c there ar
by nivertech 5y ago
Solidity (a PL in which Ethereum's so called "smart contracts"[1] are developed) has version pragmas [2] at the top of each file.
That's necessary b/c there are lots of breaking changes between language/compiler versions[3].
--
[1] they are more like DB triggers than contracts
[2] https://docs.soliditylang.org/en/develop/layout-of-source-files.html#version-pragma https://docs.soliditylang.org/en/develop/layout-of-source-fi...
[3] https://docs.soliditylang.org/en/develop/050-breaking-changes.html https://docs.soliditylang.org/en/develop/050-breaking-change...
- woodruffw 5y agoVersion pragmas themselves aren't new -- even Perl has them[1]. What makes Rust's implementation nice (and somewhat unique) is its commitment to backwards compatibility while allowing codebases to incrementally move towards a new edition. [1]: https://perldoc.perl.org/functions/use https://perldoc.perl.org/functions/use
- tialaramex 5y agoFrom one your links: > It just instructs the compiler to check whether its version matches the one required by the pragma. If it does not match, the compiler issues an error. This is very different from Rust where your Rust 1.56.0 compiler will cheerfully compile Rust 2015, Rust 2018 and Rust 2021 code, into the same program even. Rust editions are not about the compiler version, they're about the language and every Rust compiler will compile every language edition it knows about.