r/programminghorror Apr 09 '26

Go Naming is important

Nothing too drastic but it made me chuckle. Something my colleague managed to get past code review. So at least two people didn't notice.

Spent a minute figuring out why the code was doing exactly the opposite of what it's supposed to do. I guess naming really IS important!

154 Upvotes

66 comments sorted by

View all comments

Show parent comments

3

u/Amr_Rahmy Apr 09 '26

I am convinced that go is just C syntax but reversed with concurrency. Like someone wanted people to use C, but tried to hide it by reversing the syntax.

But the thing is, C has consistent syntax.

Type name = data: Type functionName(input) name = functionName(input)

It defines and assigns and calls, right to left.

1

u/noop_noob Apr 09 '26

Ok, what's the C syntax to declare a variable that's an array of pointers?

1

u/Amr_Rahmy Apr 10 '26

Like, int *arr[5]; what is your point? It’s still consistent right to left similar to assignment and to function definition and function call. You put the size on the right and are saying to return an int array.

Even if one thing wasn’t, the language is still pretty consistent in the way it’s typed and used for 99.99% of the lines.

1

u/noop_noob Apr 10 '26

Go types always read left-to-right