Earlier quoted context omitted.
Just like language shapes the way we think and talk about things, programming languages shape both what libraries are written and how. You could write anything in anything so long as it's Turing complete, but in real life we see clearly that certain design decisions at the language level either advantage or disadvantage certain types of solutions. Everyone could in theory write C without any memory issues, but we all…
The Sapir Whorf hypothesis has long been debunked: https://en.m.wikipedia.org/wiki/Linguistic_relativity
Matt Godbolt sold me on Rust by showing me C++
301–310 of 675 posts
Re: Matt Godbolt sold me on Rust by showing me C++
#302Earlier quoted context omitted.
> -Wconversion ... assumes converting 1000.0 to 1000 is ok due to no loss in precision. Additionally, `clang-tidy` catches this via `bugprone-narrowing-conversions` and your linter will alert if properly configured.
My opinion is that if you need to run extra tools/linters in order to catch basic errors, the language & its compiler are not doing enough to protect me from correctness bugs. I do run clippy on my Rust projects, but that's a matter of style and readability, not correctness (for the most part!).
Re: Matt Godbolt sold me on Rust by showing me C++
#303Earlier 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?
Re: Matt Godbolt sold me on Rust by showing me C++
#304Earlier quoted context omitted.
And it will look like this: https://rust-unofficial.github.io/too-many-lists/sixth-final... (filled with boilerplate, strange Rust idioms, borrow_unchecked, phantomdata, and you still have to manage lifetimes annotations).
And? I don't really see the issue. It works, it is sound, and it has a nice clean interface for safe code to use. That's all I really ask for. Lots of useful things in programming are quite gnarly under the hood, but that doesn't mean those things aren't worth using.
Re: Matt Godbolt sold me on Rust by showing me C++
#305I already hated C++ (having written 100s of thousands of lines of it in games and at FAANG) I'd be curious to know what if any true fixes are coming down the line. This talk: "To Int or to Uint, This is the Question - Alex Dathskovsky - CppCon 2024" https://www.youtube.com/watch?v=pnaZ0x9Mmm0 Seems to make it clear C++ is just broken. That said, and I wish he'd covered this, he didn't mention if the flags he brings u…
> speaking of which, according to another C++ talk, something like 60% of rust crates are dependent on unsafe rust. It's probably not the source of the stats you had in mind since it's discussing something slightly different, but the Rust Foundation built a tool called Painter [0] for this kind of analysis. According to that [1]: > As of May 2024, there are about 145,000 crates; of which, approximately 127,000 contai…
That's not going into the weeds, by that logic (Nirvana fallacy) no language is safe, you're going to die, so why bother about anything? Just lie down and wait for bugs to eat you.
Re: Matt Godbolt sold me on Rust by showing me C++
#306What 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++
#307All this has been known in the PL design community for decades if not half a century by now. Two things are incredibly frustrating when it comes to safety in software engineering: 1. The arrogance that "practitioners" have against "theorists" (everyone with a PhD in programming languages) 2. The slowness of the adoption of well-tested and thoroughly researched language concepts (think of Haskell type classes, aka, Ru…
I've thought Rust picked some pretty nifty middle ground. On one side, it's not mindfucking unsafe like C. It picked to remove a set of problems like memory safety. On the other side, Rust didn't go for the highest of theoretical grounds. It's not guaranteeing much outside of it, and it also relies a bit on human help (unsafe blocks).
Re: Matt Godbolt sold me on Rust by showing me C++
#308Earlier quoted context omitted.
The Rust community is helpful... but also quite political and extremely hostile to anyone who doesn't share those politics. Even something as anodyne as saying "let's keep politics out of technical discussion" is frequently met with hostility (because many community members believe that tech is inherently political and that trying to keep politics out is really just a bad faith attempt to frame things in terms of the…
JeanHeyd's side of the RustConf thing: https://thephd.dev/i-am-no-longer-speaking-at-rustconf-2023
Re: Matt Godbolt sold me on Rust by showing me C++
#309Earlier quoted context omitted.
I'm inferring that you think Rust adds too much brain drain? If so, what?
The borrow checker rejects loads of sound programs - just read https://rust-unofficial.github.io/too-many-lists/ Aliasing rules can also be problematic in some circumstances (but also beneficial for compiler optimisations). And the orphan rule is also quite restrictive for adapting imported types, if you're coming from an interpreted language. https://loglog.games/blog/leaving-rust-gamedev/ sums up the main issues ni…
It's important to be careful here: a lot (most? all?) of these rejections are programs that could be sound in a hypothetical Rust variant that didn't assert the unique/"noalias" nature of &mut reference, but are in fact unsound in actual Rust.
Re: Matt Godbolt sold me on Rust by showing me C++
#310Earlier quoted context omitted.
>what are they supposed to do when there is no memory left Well on Linux they are apparently supposed to return memory anyway and at some point in the future possibly SEGV your process when you happen to dereference some unrelated pointer.
You can tell Linux that you don't want overcommit. You will probably discover that you're now even more miserable and change it back, but it's an option.