4 ms·
Funny thing, I've been moving Swift to C++, for real. I'm paying a price, but also getting some benefits. I'm not convinced that giving up on C++ and rewriting
by hotmustard 4y ago
Funny thing, I've been moving Swift to C++, for real. I'm paying a price, but also getting some benefits. I'm not convinced that giving up on C++ and rewriting everything in a new language is a great idea. If I could get some compiler extensions to give me some experimental toys and syntactic sugar, I'd never be tempted by Rust/Swift/etc.
- nequo 4y agoFor what use cases have you been moving from Swift to C++ and what benefits have you seen? Unrelatedly, given that they all compile down to LLVM IR, in some sense Rust, Swift, and C++ are all syntactic sugar, aren’t they?
- hotmustard 4y agoYes, and no. I think Swift is doing some things that it can't optimize as well yet. I have some guesses about what that is (forced ref-counting, less control over memory layout, generics), but all I know is I'm getting significant performance gains in some graphics/geometry algorithms where I want to be a performance perfectionist and control everything. This is not a common use case. For building a basic app for iOS, Swift would be way easier. I've also decided to support other platforms, and when you want to build for Linux, Android, Windows... Swift loses appeal. Swift is quickly gaining on C++'s infamous "complexity". If you get in the deeper with generics, it's rough. I've seen recent experiments by Herb Sutter and Sean Baxter, giving C++ a new syntax or adding experimental features as compiler extensions. This makes me think C++ is going to continue to evolve. How exactly, nobody's sure. :)
- phil-m 4y agoWhy C++ though, when there's Rust? I understand that rewriting/refactoring projects from C++ to Rust may not be a good idea (in most cases at least). But starting a new project (or porting from a different language) in C++ doesn't make sense to me nowadays (unless pretty much any potential dependency of that project is written in difficult-to-wrap-in-Rust C++) Especially if you're coming from Swift anyways (which is more closer to Rust than C++).
- PhilipRoman 4y agoYou could also compile Python to LLVM IR. That doesn't say anything about Python.