4 ms·
Yeah, it's one of my two main languages for new projects. I mostly write system tools and cloud-focused tools. For the former I use C++, for the latter it's Go
by knorker 4y ago
Yeah, it's one of my two main languages for new projects.
I mostly write system tools and cloud-focused tools. For the former I use C++, for the latter it's Go.
The portability of C++ just can't be beat. At worst you have to restrict yourself to a certain earlier C++ version (e.g. C++14), but the pure "access" you get to the system is unbeatable.
E.g. you need to call exactly these low level functions in exactly this order? C or C++ is all there is.
And manual memory management is a terrible way to live your life, so C++ it is. (the modern kind, the one where you never write `new` or `delete`, basically ever)
Go seems like it tries to be a systems language, but it's failing at it. The portability is just fundamentally misdesigned. +build comments based on OS name are a known antipattern, and just are neither backwards nor forwards compatible.
Even the stdlib has different function signatures depending on the OS, so you can't a portable use of select(2).
Go is great for tying together parts, though. Read some stuff from GCS, stuff it into PostgreSQL, publish a message on Cloud PubSub, and update a load balancer certificate. I sure wouldn't want to do that in C++ for a small tool.
I should learn Rust. I hear good things. But in order to replace Go it'd need great Cloud support, and that seems to be lacking. And to replace C++ I'd need to actually be able to build and run stuff, even on my Debian oldstable. Too many modern languages require you to upgrade your entire OS in order to get a build environment, and that's a showstopper for me in some installations.
If I can't run my tool in that older environment, then it's not solving my problem.
But maybe it's fine. Like I said, I should learn Rust.
- cbm-vic-20 4y agoLearn Rust. Ignore the foamers who claim Rust is a gift from the divine. Rust is a harsh mistress, however, as it really forces you think about how your program uses memory. That's the "learning curve" everyone talks about, but if you're already steeped in C/C++ and understand how to use memory in those languages, the curve isn't so bad.