white space being used significantly/meaningfully for syntax like python or yaml is a horrendous idea in my opinion

how awful is my take

  • 5

    Whitespace Matters
  • 2
    Well, using whitespace just for visual aid might be even worse since it can mislead you.
  • 2
    if (false) ;
  • 0
    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.
  • 0
    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.
  • 0
    @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.
  • 3
    @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.
  • 2
    You probably mean indentation as syntax being a horrible idea.

    Which, if someone doesn't agree with, is probably a psychopath.
  • 0
    @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.
  • 0
    @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.
  • 0
    @aaronswart no
  • 1
    @Demolishun yeah if a language has good tooling around it it's still bearable
  • 0

    > 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)
Add Comment