this post was submitted on 10 Feb 2024
630 points (100.0% liked)

196

17532 readers
549 users here now

Be sure to follow the rule before you head out.


Rule: You must post before you leave.



Other rules

Behavior rules:

Posting rules:

NSFW: NSFW content is permitted but it must be tagged and have content warnings. Anything that doesn't adhere to this will be removed. Content warnings should be added like: [penis], [explicit description of sex]. Non-sexualized breasts of any gender are not considered inappropriate and therefore do not need to be blurred/tagged.

If you have any questions, feel free to contact us on our matrix channel or email.

Other 196's:

founded 2 years ago
MODERATORS
(page 2) 50 comments
sorted by: hot top controversial new old
[–] [email protected] 12 points 1 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

[–] [email protected] 14 points 1 year ago (2 children)

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

load more comments (2 replies)
[–] [email protected] 5 points 1 year ago* (last edited 1 year ago)

Why would a development environment show you code in a different style from what you like? It's a simple conversion.

Why would your IDE show you code in a language other than you prefer? It's just a conversion.

Even my web browser shows any text in languages I can read, but for some reason it doesn't let me edit a document through the translation.

[–] [email protected] 10 points 1 year ago

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

[–] [email protected] 3 points 1 year ago (2 children)

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

load more comments (2 replies)
[–] [email protected] 5 points 1 year ago (1 children)

If prefer two spaces per indention instead of tabs, but otherwise I agree with the choice of style.

[–] [email protected] 5 points 1 year ago (2 children)

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

[–] [email protected] 12 points 1 year ago (1 children)

Change your tab width, but tabs are literally made for indentation.

[–] [email protected] 3 points 1 year ago (1 children)

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.

[–] [email protected] 4 points 1 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.

[–] [email protected] 9 points 1 year ago (1 children)

I love compromises, so I use 3 spaces for indentation.

[–] [email protected] 4 points 1 year ago (1 children)

Some people just want to see the world burn 😁

[–] [email protected] 3 points 1 year ago

It's warm and bright when everything burns.

[–] [email protected] 73 points 1 year 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?

[–] [email protected] 34 points 1 year ago

Allman all the way baybeeee

[–] [email protected] 5 points 1 year ago

Meh, it's what you get when you write a language in a different language's "style".

[–] [email protected] 10 points 1 year ago (1 children)

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

[–] [email protected] 11 points 1 year 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.

[–] [email protected] 38 points 1 year ago

Do I need to call your parens*

[–] [email protected] 2 points 1 year ago

You should see how a Lisper writes in their native language

They are super extra not okay

load more comments (1 replies)
[–] [email protected] 14 points 1 year ago* (last edited 1 year ago)

People code like that????

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

Words cannot express my displeasure

[–] [email protected] 54 points 1 year ago* (last edited 1 year ago) (3 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.

[–] [email protected] 8 points 1 year ago

In my first ever programming class textbook was using Allman. Probably for this reason, it is easy for a beginner to match braces. It is a lot loss common industry to my knowledge.

[–] [email protected] 6 points 1 year ago (1 children)

this is only true if you don’t indent properly

[–] [email protected] 6 points 1 year ago (1 children)

I literally don't understand. I've read your comment several times and I don't know what you're talking about. Sorry!

Did you think I was saying that made Allman better than the best way? Because it's easy to scan vertically the best way, too. It's just also easy with Allman, so it's not offensive.

load more comments (1 replies)
[–] [email protected] 33 points 1 year ago

Plus one for Allman gang

[–] [email protected] 1 points 1 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.

[–] [email protected] 13 points 1 year ago (1 children)
load more comments (1 replies)
[–] [email protected] 31 points 1 year ago (1 children)

Haskell, baby, what is you doing??

[–] [email protected] 5 points 1 year ago

I might have to give this a try 😹

[–] [email protected] 18 points 1 year ago (2 children)

That's not Lisp...

(while (== x y)
  (func1)
  (func2)
)
[–] [email protected] 16 points 1 year ago (1 children)

(((((Not(enough)))((parentheses)))))

[–] [email protected] 7 points 1 year ago (1 children)

No syntax, only parentheses

load more comments (1 replies)
[–] [email protected] 8 points 1 year ago

What kind of monster writes lisp with the closing bracket on its own line.

[–] [email protected] 32 points 1 year ago

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

load more comments
view more: ‹ prev next ›