7 ms·
> Transpiling to C++ means it will work wherever C++ works. This approach is similar to Rust's editions. IIUC, nearly all of the differences been editions are
by cpeterso 4y ago
> Transpiling to C++ means it will work wherever C++ works.
This approach is similar to Rust's editions. IIUC, nearly all of the differences been editions are compartmentalized in the frontend, deprecating syntax and rewriting old edition code to rustc's current IR.
- tialaramex 4y agoRust's Editions specifically only change the concrete syntax, although there have been hacks to make some stuff that would otherwise be impossible become possible by retrospectively making how things used to work a special case, and of course if some feature needs syntax then you can't use it from an Edition which doesn't have that syntax (e.g. async doesn't exist in Rust 2015 edition) Here's the guide explaining the most significant hack: https://doc.rust-lang.org/edition-guide/rust-2021/IntoIterator-for-arrays.html https://doc.rust-lang.org/edition-guide/rust-2021/IntoIterat... There was a proposal to do Editions for C++, Epochs, https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1881r0.html https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p18... but it was not accepted.
- kibwen 4y agoRust editions can technically change some aspects of the language semantics, but this ability is used sparingly. An example is how the `iter` method on fixed-size arrays changed in the most recent edition. As long as code from all editions can still be used together, a semantic change is possible.
- tialaramex 4y ago> An example is how the `iter` method on fixed-size arrays changed in the most recent edition. Can you explain? The array type doesn't have an iter() method. It will coerce into a slice, which does have an iter() method, but doesn't care whether it's an array we're slicing.
- kibwen 4y agoI was misremembering, it was `into_iter` rather than `iter` that was changed. The documentation for the change can be found here: https://doc.rust-lang.org/edition-guide/rust-2021/IntoIterator-for-arrays.html https://doc.rust-lang.org/edition-guide/rust-2021/IntoIterat...
- deleted 4y ago[deleted]
- ehzy 4y agoThat's not what they're talking about here. They're saying that any system with a C++ compiler is a target for this new language, as opposed to Rust, which only runs on systems with a LLVM backend.
- humanrebar 4y agoYes. This. Assuming some niche embedded cross compilation toolchain uses C++23, it would support cpp2.