this post was submitted on 14 Aug 2023
42 points (100.0% liked)

Programmer Humor

19176 readers
1200 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] CodeBlooded@programming.dev 1 points 1 year ago* (last edited 1 year ago) (20 children)

If this language feature is annoying to you, you are the problem. You 👏are 👏 the 👏 reason 👏 it 👏 exists.

I worked in places where the developers loaded their code full of unused variables and dead code. It costs a lot of time reasoning about it during pull request and it costs a lot of time arguing with coworkers who swear that they’re going to need that code in there next week (they never need that code).

This is a very attractive feature for a programming language in my opinion.

PS: I’m still denying your pull request if you try to comment the code instead.

❗️EDIT: A lot of y’all have never been to programming hell and it shows. 🪖 I’m telling you, I’ve fixed bayonets in the trenches of dynamically typed Python, I’ve braved the rice paddies of CICD YAML mines, I’ve queried alongside SQL Team Six; I’ve seen things in production, things you’ll probably never see… things you should never see. It’s easy to be against an opinionated compiler having such a feature, but when you watch a prod deployment blow up on a Friday afternoon without an easy option to rollback AND hours later you find the bug after you were stalled by dead code, it changes you. Then… then you start to appreciate opinionated features like this one. 🫡

[–] Urik@lemmy.ca 1 points 1 year ago* (last edited 1 year ago) (1 children)

That's a problem with your workplace, not the language nor OP.
You could have a build setting for personal development where unused variables are not checked, and then a build setting for your CI system that will look for them. It gives you freedom to develop the way you want without being annoyed when you remove something just to test something, but will not merge your PR unless the stricter rules are met.

[–] LittleLordLimerick@lemm.ee -2 points 1 year ago (1 children)

Why in the world would you want to develop something that doesn't follow the coding rules required by your org, just so you can go back and fix everything before submitting a PR? That's just extra work.

[–] planish@sh.itjust.works 1 points 1 year ago (1 children)

Because you want to know if the first half of the code works at all before you write the whole second half.

Finding all the bits that will be used by the second half and changing the declarations to just expressions is a bunch of extra work. As is adding placeholder code to use the declared variables.

[–] LittleLordLimerick@lemm.ee 0 points 1 year ago (1 children)

I'm having a hard time envisioning a situation where testing my code requires a bunch of unused variables. Just don't declare the variables until you've started writing the code that uses them...

[–] Urik@lemmy.ca 1 points 1 year ago

Most of the time you don't write the code, you change it.

I had tons of situations where I wanted to test deleting a code block which just happened to use an imported library, which the compiler is now complaining about because it's no longer being used.

load more comments (18 replies)