Hacker News new | ask | show | jobs
by fndrplayer13 3696 days ago
Agree that swift (and other languages like Rust for that matter) offer some very nice advantages over C++. However, C++ is so well established and has a rich collection of libraries and integrations. You can write a library in C++ and ship it on nearly everything. You can also optimize the parts of your system that are well-suited to a systems-language like C++ and then easily expose them in other languages like Python, Ruby, Go, Swift, etc. via their C-bindings.

We can't say that (yet) about Swift and Rust. In 3-5 years I think this is going to be a very different conversation, though.

In my mind, C++'s flexibility is both its greatest benefit and its greatest danger. You can do almost anything, and there are so many ways to do it. I agree this is a "problem" that's likely not going to be fixed. You can ask your fellow developers to read Scott Meyer's Effective (Modern) C++, you can go to meetups, listen to the wisdom of the steering committee, etc. but at the end of the day it really boils down to the fact that your team needs to be committed to being resilient and responsible. That's true in any language, but much more so in C++.

3 comments

Rust actually has a really nice embedded library story, and I've already seen a few things in Ruby or Go that have started using Rust libraries for performance. https://github.com/BurntSushi/rure-go for example, just to pick something that's crossed my feeds recently.

Not sure about Swift, I haven't really been paying attention in that space.

That is what eventually made me more focused on JVM and .NET languages, with C++ only being used only for lower level infrastructure code if at all needed.

Writing proper code in C++ requires, as you say, "your team needs to be committed to being resilient and responsible", which just doesn't happen on my little piece of the world.

So using it in personal projects, yeah. At work, not really.

At least two production users of rust are explicitly embedding rust in Ruby. The Node bindings (neon) are really great too.

Even then, in C++ you still need to expose a C interface, so it feels at least on even footing with Rust. But of course, I am biased...