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
-
Well, using whitespace just for visual aid might be even worse since it can mislead you.
-
Disagree. Reason: Humans use whitespace to make blocks in their head. It is a good idea when Humans and Computers read the code the same way.
With other methods, you have redundancy. In a well formated C source file, you can tell where a block starts and ends just using whitespace and ignoring { and }, but you can also do that by just looking a { and } and ignoring whitespace.
Now what happens when there is a inconsistency? Humans will understand it differently (without a closer look you don't normally do) than the computer, which can lead to bugs. -
You may now argue you can use auto formatting to always create the correct whitespace. But this isn't always done and many people use indentation styles that are horrible to read. And what is the advantage of using { and } ? When you want the code to be formatted in a specific way, which you should, then why should the computer not use this information directly?
If you stumble across code already used in production, where the indention style suggests something different than what the {} actually tell, how do you determine what is correct? Do you reformat it or do you change the placements of the {}?
Data redundancy is just bad. Ask anyone that works with databases. -
@aaronswart Using tabs prevents you from align things. Well, you can do it too but then you have to relay on a specific tabstop settings, getting you the worst of both worlds.
-
hitko31482y@Demolishun @happygimp0 Cut the crap. Everyone agrees that whitespaces and visual cues are important for code readability, that's clearly not the argument here.
The problem with whitespaces in Python and Yaml is that you never explicitly tell where you want a block to end, so it's really easy to accidentally put some code into the wrong block simply by missing an indentation. It's also perfectly valid to mix whitespace characters and to vary the number of characters per indentation level. Would anyone do it intentionally? No. But with multiple people having varying indentation preferences and moving blocks of code around, these problems happen and they're hard to notice. -
You probably mean indentation as syntax being a horrible idea.
Which, if someone doesn't agree with, is probably a psychopath. -
@hitko You've done a better job expressing what I meant. I recently ran into an issue where I was adding to a yaml and I thought my changes were correct but they weren't.
Indenting mattering and I thought it looked correct , but it wasn't. It was a shitty debugging experience. -
@hitko I was pointing out that whitespace is important and significant to syntax. If someone wants to say that whitespace shouldn't be used for scoping then that is a different topic. I completely understand the frustration. I was also having fun and going to the extreme interpretation.
I didn't like yaml, I was okay with Python. But if someone is going to program Python they should be following pep8. This solves a lot of the indentation issues by standardizing what to use. I also tend to use editors that visualize the whitespace and scoping. This helps even in languages like C++. PyCharm is good for helping deduce whitespace issues.
I think the biggest issue with yaml is the editors people tend to use are console based. -
@sjwsjwsjw
> I thought it looked correct , but it wasn't.
This can also happen when you use {}, especially whit bad code styles (which sadly are very common)
white space being used significantly/meaningfully for syntax like python or yaml is a horrendous idea in my opinion
how awful is my take
rant