Live data from Hacker News

Matt Godbolt sold me on Rust by showing me C++

collabora.com

271–280 of 675 posts

Re: Matt Godbolt sold me on Rust by showing me C++

#271

Earlier quoted context omitted.

How can you simultaneously call cpp a mature language with mature tooling and acknowledge that there's no working package manager used by any "serious" project?

Do you people really not realize how completely asinine you sound with these lowbrow comments? I'll give you a hint: did you know that C also has no package manager?

[flagged]

Re: Matt Godbolt sold me on Rust by showing me C++

#272

Earlier quoted context omitted.

Do you people really not realize how completely asinine you sound with these lowbrow comments? I'll give you a hint: did you know that C also has no package manager?

Yeah, and it's also much worse for it. There's a reason everyone in C uses their own linked list implementation and it's not because it's a platonic ideal of perfect software.

The question wasn't whether C/C++ are platonic ideals, the question was whether a language can be mature without a package manager.

Re: Matt Godbolt sold me on Rust by showing me C++

#273

Earlier quoted context omitted.

> Every single package manager couldn’t handle my very basic and very popular dependencies Well there's your problem - no serious project uses one. > I’m convinced it’s a bunch of masochists People use cpp because it's a mature language with mature tooling and an enormous number of mature libraries. Same exact reason anyone uses any language for serious work.

How can you simultaneously call cpp a mature language with mature tooling and acknowledge that there's no working package manager used by any "serious" project?

Because cpp is not meant for "rapid prototyping" involving importing half of github with single command. And the reality is that it works.

Re: Matt Godbolt sold me on Rust by showing me C++

#275
post #67

Earlier quoted context omitted.

> The one thing that sold me on Rust (going from C++) was that there is a single way errors are propagated: the Result type. No need to bother with exceptions This isn't really true since Rust has panics. It would be nice to have out-of-the-box support for a "no panics" subset of Rust, which would also make it easier to properly support linear (no auto-drop) types.

I wish more people (and crate authors) would treat panic!() as it really should be treated: only for absolutely unrecoverable errors that indicate that some sort of state is corrupted and that continuing wouldn't be safe from a data- or program-integrity perspective. Even then, though, I do see a need to catch panics in some situations: if I'm writing some sort of API or web service, and there's some inconsistency in…

Using a Rust lib from Swift on macOS I definitely want to catch panics - to access security scoped resources in Rust I need the Rust code to execute in process (I believe) but I’d also like it not to crash the entire app.

Re: Matt Godbolt sold me on Rust by showing me C++

#276
post #204

Earlier quoted context omitted.

Facebook's Folly has a similar type: folly::Expected (dating to 2016).

If I had to guess, that idea came from Andrei Alexandrescu.

Bingo.

https://github.com/facebook/folly/commit/4d932ecc53c7a722671...

Re: Matt Godbolt sold me on Rust by showing me C++

#277

Earlier quoted context omitted.

Yeah, and it's also much worse for it. There's a reason everyone in C uses their own linked list implementation and it's not because it's a platonic ideal of perfect software.

The question wasn't whether C/C++ are platonic ideals, the question was whether a language can be mature without a package manager.

If we take “mature” to mean “old” then yes - C and C++ are certainly old. If we take “mature” to mean “good”, then my answer changes.

Re: Matt Godbolt sold me on Rust by showing me C++

#278
post #252

Earlier quoted context omitted.

The result type does make for some great API design, but SerenityOS shows that this same paradigm also works fine in C++. That includes something similar to the ? operator, though it's closer to a raw function call. SerenityOS is the first functional OS (as in "boots on actual hardware and has a GUI") I've seen that dares question the 1970s int main() using modern C++ constructs instead, and the API is simply a lot b…

> I think c++, the language, is ready for the modern world. However, c++, the community, seems to be struck at least 20 years in the past. Good point. A language that gets updated by adding a lot of features is DIVERGING from a community that has mostly people that still use a lot of the C baggage in C++, and only a few folks that use a lot of template abstraction at the other end of the spectrum. Since in larger sys…

Just give Rust 36 years of field use, to see how it goes.

Re: Matt Godbolt sold me on Rust by showing me C++

#279
post #8

The one thing that sold me on Rust (going from C++) was that there is a single way errors are propagated: the Result type. No need to bother with exceptions, functions returning bool, functions returning 0 on success, functions returning 0 on error, functions returning -1 on error, functions returning negative errno on error, functions taking optional pointer to bool to indicate error (optionally), functions taking r…

unfortunately it's not so simple. that's the convention. depending on the library you're using it might be a special type of Error, or special type of Result, something needs to be transformed, `?` might not work in that case (unless you transform/map it), etc. I like rust, but its not as clean in practice, as you describe

You can use anyhow, but yeah zig generally does errors better IMO

Re: Matt Godbolt sold me on Rust by showing me C++

#280
post #156

Earlier quoted context omitted.

The result type does make for some great API design, but SerenityOS shows that this same paradigm also works fine in C++. That includes something similar to the ? operator, though it's closer to a raw function call. SerenityOS is the first functional OS (as in "boots on actual hardware and has a GUI") I've seen that dares question the 1970s int main() using modern C++ constructs instead, and the API is simply a lot b…

C++ carries so much on its back and this makes its evolution over the past decade even more impressive.

Yes, people keep forgeting C++ was made public with CFront 2.0 back in 1989, 36 years of backwards compatibility, to certain extent.
Post reply on HN