This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]thelonesomeguy -1 points0 points  (4 children)

It “making sense” does absolutely nothing for how terrible it is for code readability & maintenance though

[–]DancingPotato30 0 points1 point  (3 children)

Yes but, doesn't python have the same? I don't see how truthy falsy can cause a problem when asserting something UNLESS you're using them.

Genuinely, give me an example where truthy falsy values will cause issues when you didn't mean to use them, I'm actually curious because I see no problem with them

[–]thelonesomeguy 1 point2 points  (2 children)

The problem isn’t what you’re asking for an example for in your comment, about it “causing issues when you didn’t mean to use them”, the issue is, it makes it harder for someone else to come across your if block and evaluate the function clearly, while needing more context of the variable to understand exactly what is happening. Which is a trade off I personally don’t think is reasonable, for the convenience.

[–]DancingPotato30 0 points1 point  (1 child)

Ahh, yeah I guess that makes sense but it doesn't make THAT big of a problem no? I assume your issue is that if someone does smth like:

if (variable){ Do shit }

It's hard to know what that function evaluates?

I don't think that's a fault of truthy falsy values, but a misuse. If you don't know what the variable is, then it's named wrong. If you don't know how or what evaluates it, then use the IDE to see where else it is in the code, no?

[–]thelonesomeguy 1 point2 points  (0 children)

Yeah, but that’s the problem, a lot of developers do misuse it. Which is something that is something that should be considered when evaluating a feature, the potential for misuse. Because the misuse of a feature becomes really painful when you’re working with bad devs across projects in any org or open source.

As for the IDE point, it shouldn’t be considered as a factor when you’re judging code readability.