• @psycho_driver@lemmy.world
        link
        fedilink
        31 year ago

        If you use if (blah) { then when you fold your code you still see the { but not the closing } (I suppose some IDEs might be smart enough to do something about this, but when not it looks like your code has an overbite).

        And then you’ve got a mental disorder if you indent your opening and closing brace more than the statement spawning them.

        • JackbyDev
          link
          fedilink
          English
          41 year ago

          Yeah, I just don’t see why IDEs couldn’t make them all fold in the same way. It’s trivial. I don’t see it as a valid complaint.

  • Spaghetti_Hitchens
    link
    fedilink
    11 year ago

    I might argue that rhe syntax of God’s language is the one true syntax.

    I am tired and unmotivated so I probably won’t though.

  • @Psythik@lemmy.world
    link
    fedilink
    101 year ago

    If you have ADHD, your coding style is a combination of all of these, and sometimes none of the above.

  • Allmans what I learnt then went to K&R on my own because it made more sense to me. I think GNU is fine I guess, not the others though. Not that what I say matters I’ve forgotten how to code and can barely do Hello World these days.

  • @Bonsoir@lemmy.ca
    link
    fedilink
    31 year ago

    That’s why Python has a superior syntax. There is usually one obvious way to do it, and that’s the right way.

    • @BeigeAgenda@lemmy.ca
      link
      fedilink
      51 year ago

      Tabs has no place in code, just recently I started a project with four space indentation, that quickly got changed to two.

        • @BeigeAgenda@lemmy.ca
          link
          fedilink
          31 year ago

          The reason I loathe tabs is that over time a codebase with tabs becomes mixed tabs and spaces and unless your editor shows tabs you can’t see them.

          In the end you have to choose either spaces or tabs, and enforce it with some lint tool.

          • @Luvon@beehaw.org
            link
            fedilink
            41 year ago

            That last line is the solution though, choose a linter, enforce all style arguments, so they are just the way the code is. No arguments.

            Every single project I work on is setup with prettier. With Java there is a maven plugin that runs it on compile. And with ts projects it is part of the built pipeline.

            I wish I could use prettier for Abap, reminds me how much I like having an opinionated formatter. I don’t like wasting time formatting code manually.

            Abap has one formatter that is not very opinionated, and lets way more to much wierd spacing through, especially for a language that is as verbose as abap.

    • @wer2@lemm.ee
      link
      fedilink
      21 year ago

      To be fair, some of these look very different in non-C-like languages (e.g. Lisp/Haskell).

  • glibg10b
    link
    fedilink
    101 year ago

    I use Allman for control statements and K&R for declarations

  • @barsoap@lemm.ee
    link
    fedilink
    23
    edit-2
    1 year ago

    Noone writes Haskell like that. People generate Haskell like that because layout syntax is a fickle beast to generate and outputting braces means you can make mistakes in layout without breaking things, the way the braces and semicolons are output emphasise how they actually don’t matter, they’re also easy to delete in a text editor.

    Also it matches up with other Haskellisms, e.g. lists:

    let foo = [ bar
              , baz
              , quux
              ]
    

    See how it’s immediately apparent that you didn’t miss a single comma? It’s also trivial to match up opening and closing brackets like that, even in deeply nested situations.

    Not doing that is actually my main pet peeve with Rust’s standard formatting.

  • @fidodo@lemmy.world
    link
    fedilink
    English
    121 year ago

    Looking at them all, I don’t hate whitesmiths. Keeps all the associated block on one line which makes it a bit easier to parse