If you want to mess around with machine learning, learn enough Python for it.
Id you want to make a mobile app, learn Swift or Kotlin.
I get that this crowd will nerd out on language specifics.. but at the end of the day if we're good engineers we should use the best tool for the job.
I'm ambivalent about Rust, but its best feature compared to C++ is a universal package manager and build system. I like vcpkg well enough, but it's not Cargo, it can't be.
If we get a C++ Copilot as "borrow checker" that is already quite an improvement, even if not perfect.
Hmm, another idea: what if a language's compiler itself use an LLM to find invariants and issues (like race conditions) in the code?
In any case, taken to the extreme, the language won't matter any longer, beyond some druids with the knowledge to implement Star Trek like computing models.
We will be left to architect roles.
If they're unused, then they're not helping with debugging either...
It's quite a bizarre reason
At least this is how it works in C and C++.
#![allow(dead_code)]
at the root of the crateI'm not sure what you mean by "optimizing away unused variables", so I'm interpreting it as variables that are literally unused after declaration.
I believe you're confusing Rust with Go. In Rust, an unused variable is just a warning, unless you explicitly asked the compiler to turn that warning (or all warnings) into an error.
What you cannot have, is uninitialized variables which are used.
And as someone else said, if all you want is unused variables without warnings, you can say at the top of the root of the crate (`main.rs` or `lib.rs`):
#![allow(dead_code)]Rust actually does allow uninitialized variables, even in safe code. But it'll be a compiler error if you try to use them in any way before initializing them, so this is mostly just a curiosity: https://play.rust-lang.org/?version=stable&mode=debug&editio...
I took the approach of learning it as a brand new language that I knew nothing about, and especially avoiding thinking about what I already knew about C++ and especially C. The result was a language that yes, is a pleasure to work in.
Of course some context could not be ignored: there are about six ways to do many things because of back compatibility. But that back compatibility is why so many people use it. I write in one style, and just know the others for reading other people's code.
Users of 1996's Java won't recognise Java 21, or 2001's C# versus C# 12.