2 ms·
I tried Rust this past weekend. It feels like a language that delivers on the promise of C++ -- fast, good "static" tooling, no VM, scalable to large projects -
by eldavido 6y ago
I tried Rust this past weekend. It feels like a language that delivers on the promise of C++ -- fast, good "static" tooling, no VM, scalable to large projects -- but if C++ was designed today, with 40 years of hindsight and we could eliminate all the crazy legacy.
Something I realized doing c++ professionally for the first time last year, it's nearly three different languages. There's an inner core of procedural C, the mid-90s new/delete/raw pointers OO business that got big during the heyday of COM/ATL/other Microsoft technologies, and then what's come to be known as "modern C++", with smart pointers and a lot more automatic stuff.
What I most enjoyed about C++ is how, as someone put it, it feels like an armory with everything on offer from a pocketknife to a nuclear weapon. It integrates with everything, you can write code any way you want from embedded assembly up to functional, and it runs everywhere, on any platform, and can link with Android, Windows, Linux, .NET, Java, whatever.
I'm starting to think garbage collected languages are headed for obsolescence. Like maybe, with better languages, we could ditch all the bullshit of pip, and gems, and all that, and get back to a time where you could just download something, run it, and not have to worry about some gigantic runtime environment that eats all your memory and requires a ton of configuration. It we could pull that off without making it incredibly hard to write simple code, that'd be cool.
- brundolf 6y agoGarbage collected languages are still better-suited for certain things. You can make most of those things work well enough in Rust by using Rc<>, but a) it's really clunky, and b) reference-counting has caveats, like the fact that it doesn't work for circular references. Swift solves (a), but not (b). On top of that, for programs where you need to constantly allocate/deallocate, I believe (could be wrong on this) that amortized over time, sweeping GC is quite a bit more efficient than reference counting. This is extra relevant once concurrency gets involved, because now your reference-counters have to use an atomic or locking mechanism. In short: I'm pretty sure GC isn't going anywhere, even if some of its usecases start to get covered by non-GC'd languages.