Hacker News new | past | comments | ask | show | jobs | submit login

I admit that I did over-generalise with those two statements. There's different tradeoffs one needs to do in any language regarding performance/maintenance/effort.

But for C++ there is little effort to bridge those gaps, or at least it feels that way. Maybe that's unfair of me, because C++ is very keen on backwards compatibility, though; I disagree with how religious they are about that goal, too.

Rust on the other hand strives to make idiomatic and easy-to-maintain/write/read code perform well. There are obviously high-level decision that play a role in performance, but I'm talking more about "vocabulary features" of the language/ecosystem, not the highlevel decision of "Do I use a List, a Map, or a Vector for this?"

Sure, there's ugly/unsafe and hard-to-understand parts in Rust libraries (and stdlib) too, but those warts don't leak into the "consumer" code (at least not as much). Also there's consistent effort to add DX polish to tooling, that's not such a "cultural thing" in the C++ ecosystem




There's some small effort to land quality-of-life improvements to the C++ standard library but it feels like too-little too-late.

As an example, for years C++ didn't have std::string::contains() because you could write find(x) != npos -- and so the argument is why carry around this unnecessary function? Well, because that's what programmers often actually wanted. C++ 23 will finally get std::string::contains()


> As an example, for years C++ didn't have std::string::contains() because you could write find(x) != npos

Yes, because you would have a utility header where you implemented it like so:

    bool contains(const std::string& s, char c) noexcept 
    { return s.find(c) == std::string::npos; }
> and so the argument is why carry around this unnecessary function? Well, because that's what programmers often actually wanted.

No, we didn't want the method, we wanted the function. Actually, string has way too many methods, most being useless, in the sense that they are trivial to implement as freestanding functions.

But really, what programmers (should) actually want is uniform function call syntax: https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax - which would let us blur the distinction between freestanding functions and methods.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: