top 50 comments

sorted by: hot top controversial new old
[–] 94 points 2 years ago (1 child)

Allman is very practical for JSON

  • source
  • hideshow 2 child comments
  • [–] 71 points 2 years ago (5 children)
  • load more comments (2 replies)
  • [–] 73 points 2 years ago (6 children)

    Finally, someone understands that Allman is not that great, and that Kernighan & Ritchie is the way to go. Also, Haskell, my guy, you good? Lisp, are you ok? Do I need to call your parents?

  • source
  • hideshow 9 child comments
  • [–] 10 points 2 years ago (1 child)

    I've written Haskell quite a bit, and I don't fully understand why this is called Haskell style. Haskell code looks nothing like this, the syntax is completely different. For Haskell's syntax I think it works fine, because I never noticed something weird. But this code in "Haskell style" looks absolutely insane

  • source
  • parent
  • hideshow 2 child comments
  • [–] 11 points 2 years ago

    It's sometimes called comma-leading style where you move all the special characters to the front of the line and it is exceedingly common in Haskell, possibly due to how Haskell treats significant whitespace. You've surely seen list definitions that look like this:

    someList =
      [ 1
      , 2
      , 3
      ] 
    

    or a data definition like this:

    data Color
      = Red
      | Green
      | Blue
      | RGB Int Int Int
      deriving (Show, Eq)
    

    or a list of module exports like this:

    module Foo
      { bar
      , baz
      , quux
      } 
    

    Or in a long function type declaration where the arrows are moved to the start of the line, or a record definition, etc. etc.

  • source
  • parent
  • load more comments (3 replies)
    [–] 63 points 2 years ago (1 child)

    All of those are heretical. The one True Language is Brainfuck, where the coding syntax for Hello World is

    ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.

  • source
  • hideshow 1 child comment
  • load more comments (1 reply)
    [–] 56 points 2 years ago (2 children)

    Allman looks fine to me. But I'm a C# dev so maybe I'm just used to it.

  • source
  • hideshow 3 child comments
  • load more comments (1 reply)
    [–] 54 points 2 years ago* (last edited 2 years ago) (5 children)

    idk, Allman is very readable. Easy to scan vertically to find the matching open brace. Not quite as vertically-space efficient as the best way, but it's not offensive.

  • source
  • hideshow 7 child comments
  • load more comments (3 replies)
    [–] 46 points 2 years ago (3 children)

    Allman works best if you like folding code blocks.

  • source
  • hideshow 3 child comments
  • load more comments (3 replies)
    [–] 33 points 2 years ago (1 child)

    No line breaks. Just one long line of code.

  • source
  • hideshow 2 child comments
  • [–] 33 points 2 years ago* (3 children)

    All line breaks. Just one tower of code.

    class
    HelloWorld
    {
    public
    static
    void
    main(String[]
    args)
    {
    System.out.println("Hello,
    World!");
    }
    }
    
  • source
  • parent
  • hideshow 5 child comments
  • [–] 16 points 2 years ago*

    as always, c++ lets us do better in breathtakingly elegant fashion:

    #\
    i\
    n\
    c\
    l\
    u\
    d\
    e\
     \ 
    &lt;\
    i\
    o\
    s\
    t\
    r\
    e\
    a\
    m\
    >
    

    finishing out hello world is left as an exercise to the reader, but the advantages and superior performance of this format should be obvious

  • source
  • parent
  • load more comments (1 reply)
  • [–] 32 points 2 years ago

    Tell me you're a Java developer without telling me you're a Java developer.

  • source
  • [–] 31 points 2 years ago (1 child)

    Haskell, baby, what is you doing??

  • source
  • hideshow 1 child comment
  • load more comments (1 reply)
    [–] 22 points 2 years ago* (last edited 2 years 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.

  • source
  • [+] 22 points 2 years ago (8 children)
  • load more comments (5 replies)
    [–] 18 points 2 years ago (2 children)

    That's not Lisp...

    (while (== x y)
      (func1)
      (func2)
    )
    
  • source
  • hideshow 4 child comments
  • [+] 18 points 2 years ago* (last edited 7 months ago)
    [–] 18 points 2 years ago

    Allman is objective the correct choice

  • source
  • [–] 14 points 2 years ago*

    People code like that????

    People indent braces more than the line before and less than the line after?

    Words cannot express my displeasure

  • source
  • [–] 14 points 2 years ago (1 child)

    Allman or even horstmann I could still deal with, the rest would be difficult.

    Though none are as bad as whoever came up with right aligning all the brackets to make any code look like python until you spot the deranged line of brackets on the right…

    I cannot for the life of me find it now but the dude put it on GitHub

  • source
  • hideshow 2 child comments
  • [–] 13 points 2 years ago (1 child)
    load more comments (1 reply)
    [–] 12 points 2 years 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

  • source
  • [–] 10 points 2 years ago

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

  • source
  • [–] 10 points 2 years ago (1 child)

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

  • source
  • hideshow 1 child comment
  • load more comments (1 reply)
    [–] 9 points 2 years ago (1 child)

    oh so you hate Richard stallman?

  • source
  • hideshow 2 child comments
  • [–] 7 points 2 years ago (1 child)

    Some of those made me physically ill.

    Like. You do WHAT with your whitespace?!

  • source
  • hideshow 1 child comment
  • load more comments (1 reply)
    [+] 7 points 2 years ago* (last edited 2 years ago)
    load more comments
    view more: next ›