Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API

From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
In Rust, you can do:
let x = "blah blah";
let x = x.len();
And a name that used to mean one thing now means a completely different type of thing, and if you try to use it to mean the earlier thing the compiler complains.
It makes perfect sense, and in some ways it's quite elegant, but it can be bloody confusing. -
@donkulator best use case for shadowing is safe nil/null handling:
let name: String? = "my name"
// in this scope name is optional/nullable
if let name {
// in this scope name is not nullable and definitely has a value. No need for null checks here.
}
Works the same in Kotlin but with smart casting (still shadows the old variable)
Related Rants
Female assets and their hornification value:
- tits: 10 points
- butt: 20 points
- face: 25 points
- brain: 200 points
- dick: 9999 points
A woman without a dick is like an angel without wings.
rant