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
-
Parzi86694yi never understood this. is it really so hard to remove code paths that are unused? If nothing's using it it shouldn't crash if it disappears, no?
Or is your language's parser/compiler+linker/interpreter just shit? Is the rest of the code relying on things it shouldn't? I don't at all understand. It's not even that hard when you're working with machine code unless deliberately made to be an asshole if anything changes... -
@Parzi
Well, if you remove a function which has zero measurable side effects and does not return any value (void), but it is being called, it would crash the program if you removed the function.
In interpreted languages you'd pretty much always end up severely wounded when taking wrongly placed or nonexistent stairs during runtime.
But even in compiled languages with a high degree of type system safety you could end up with issues.
In Rust, maybe_stairs.unwrap().climb() would "completely according to expectations" just terminate the program if you are attempting to climb something that "either IS or IS NOT a flight of stairs", and turns out to NOT be a flight of stairs.
Technically not a runtime error, because you are literally programming it to "climb stairs if they exist or exit program" -- intended behavior.
But it solves the problem of stepping on a nonexistent flight of stairs by shutting down the universe for safety, which might be considered extreme.
Related Rants
#truth
joke/meme
funny