PeriodicallyPedantic

joined 1 year ago
[–] [email protected] 1 points 6 months ago (2 children)

Have you stopped to consider why you can't explain it better? Perhaps the reason is because you're wrong.

Your toy example does not show the issue you think it shows. You've moved your cleanup block away from the context of what it's cleaning up, meaning that you've got variables leaking out of their scopes. Your cleanup code is now much more complex and fragile to changes in each of the blocks its cleaning up after.

You tried to use your toy example to show A is better, but then we showed that actually B is just as good. So fix your toy example to show what you actually want to say, because everything you said so far depends on you setting different standards for each scenario.

[–] [email protected] 1 points 6 months ago* (last edited 6 months ago) (4 children)

If you're reading the control flow, and the control flow tells you the first block isn't being entered, then it doesn't matter if the first block contains an early return or not, because it wasn't being entered. If it was being entered then you have to read it anyway to make sure it's not manipulating state or leaking resources.

To use your example: in subsequent reads, when I'm interested in the second block out of n, say during defect analysis, I can head straight to the second block in either case since control flow shows the first block was skipped - but in the case of early return from the second block I can stop reading, but in the case of a single return I need to read the flow for all subsequent n blocks and the business logic of any subsequent blocks that get entered. The early return is a guarantee that all subsequent blocks may be ignored.

To me this is also obvious. I've been doing this for quite a while and 95% of the time, reviewing and debugging code with a single return is far more tedious.

[–] [email protected] 2 points 6 months ago (6 children)

Right. Like I said.

What are you hoping to accomplish by only reading control flow and not the contents of the blocks? You keep raising concerns like not properly releasing resources, but if you don't read the blocks you don't know what resources we're allocated.

I think your argument depends on both having your cake and eating it.

[–] [email protected] 3 points 6 months ago (8 children)

You said yourself they're equivalent. You either have to read the blocks in both cases or neither case.

You need to read the blocks to know what gets returned (either early or in a single return). You need to read the blocks to see what resources get created but not released. What are you hoping to achieve by only reading control flow?

At least with an early return you can stop reading.

[–] [email protected] 10 points 6 months ago (11 children)

If your function is so long that keeping track of returns becomes burdensome, the function is too long.

I'm not a fan of returning status codes, but that's a pretty clear example of early return validation where you can't just replace it with a single condition check. Having a return value that you set in various places and then return at the end is worse than early return.

[–] [email protected] 2 points 6 months ago

Now that takes me back

[–] [email protected] 3 points 6 months ago

Gonna administer this yiffing

[–] [email protected] 2 points 6 months ago

Cost is the only one you can change quickly.

[–] [email protected] 5 points 6 months ago (1 children)

Oh for sure, and I'm sure that someone told him what a bad idea it was, and that he was like "NO STAINLESS STEEL DOESN'T RUST YOURE FIRED".

like... Why else would they not even attempt to figure out how to apply a clear coat? Musk must have squashed any attempts.

[–] [email protected] 2 points 6 months ago* (last edited 6 months ago)

Yeah, I know I shouldn't expect much from a site like that, but since it's shared here I felt like I should shine a little light on the deeper issues.

This kind of superficial "journalism" rage-baiting boomers for clicks is really frustrating to me. Shit like this is brain-rot at least as bad as Tiktok is. It has always existed, but the extent to which it has replaced actual analysis and investigation is depressing.

Yes, the parents are partially at fault, of course. But as you indicated, there are significant societal pressures that force families into dynamics like this and it's not realistic to expect an overwhelming majority to be able to resist it, alone. And since we're not about to engage in class-based eugenics, it's up to society to give them a serviceable ladder to climb out of their situation.

So, TLDR; I wanted to shine a light on deeper issues, so that people don't think that this is solely a moral failing of parents, and that they DO understand that we have a collective responsibility to help families.

[–] [email protected] 9 points 6 months ago* (last edited 6 months ago) (13 children)

As funny as this is, and as much as I wish it was true, unfortunately I don't think it's quite that bad

[–] [email protected] 3 points 6 months ago

Found the illiterate bootlicker ☝️

view more: ‹ prev next ›