Matt Godbolt sold me on Rust by showing me C++
collabora.com
Matt Godbolt sold me on Rust by showing me C++
1–10 of 675 posts
Re: Matt Godbolt sold me on Rust by showing me C++
#2Re: Matt Godbolt sold me on Rust by showing me C++
#3So no implicit type conversions, safer strings, etc.
Re: Matt Godbolt sold me on Rust by showing me C++
#4Re: Matt Godbolt sold me on Rust by showing me C++
#5What if we have a C that removes the quirks without adding too much brain drain? So no implicit type conversions, safer strings, etc.
Re: Matt Godbolt sold me on Rust by showing me C++
#6What if we have a C that removes the quirks without adding too much brain drain? So no implicit type conversions, safer strings, etc.
Re: Matt Godbolt sold me on Rust by showing me C++
#7What if we have a C that removes the quirks without adding too much brain drain? So no implicit type conversions, safer strings, etc.
Re: Matt Godbolt sold me on Rust by showing me C++
#8Then you top it on with `?` shortcut and the functional interface of Result and suddenly error handling becomes fun and easy to deal with, rather than just "return false" with a "TODO: figure out error handling".
Re: Matt Godbolt sold me on Rust by showing me C++
#9The conversation function is more language issue. I don’t think there is a simple way of creating a rust equivalent version because C++ has implicit conversions. You could probably create a C++ style turbofish though, parse([your string]) and have it throw or return std::expected. But you would need to implement that yourself, unless there is some stdlib version I don’t know of.
Don’t conflate language features with library features.
And -Wconversion might be useful for this but I haven’t personally tried it since what Matt is describing with explicit types is the accepted best practice.
Re: Matt Godbolt sold me on Rust by showing me C++
#10What if we have a C that removes the quirks without adding too much brain drain? So no implicit type conversions, safer strings, etc.
This seems like such an obvious thing to have - where is it? Zig, Odin, etc. all seem much more ambitious.
> eventually I came to the depressing conclusion that there’s no way to get a group of C experts — even if they are knowledgable, intelligent, and otherwise reasonable — to agree on the Friendly C dialect. There are just too many variations, each with its own set of performance tradeoffs, for consensus to be possible.