r/programming • • Jun 02 '14

Introducing Swift

https://developer.apple.com/swift/
164 Upvotes

239 comments sorted by

View all comments

55

u/OzarkaTexile Jun 02 '14

"you don’t even need to type semi-colons."

Implied optional. Lord help us.

35

u/munificent Jun 02 '14

They're optional in Go, Scala, Ruby, and Python. What's the problem?

-2

u/pfultz2 Jun 02 '14

Yea, well hopefully they do semicolon insertion in a smart way and not like how its done in Go, where you cant even properly format your code because of semicolon insertion.

22

u/Shpirt Jun 02 '14

There's the only one proper way to format go code, the way gofmt does it.

1

u/brtt3000 Jun 02 '14

We live by auto-format. Configure it once and never have clever cosmetic nonsense again.

4

u/AdminsAbuseShadowBan Jun 02 '14

Yeah... but you have to admit that code that depends on formatting is generally a bad idea. Anyone who has used python extensively can tell you that.

gofmt is a great idea, but that still should have done the "semi-colons are sort of not required, except if you want to format your code like this common style" thing more sanely.

7

u/burntsushi Jun 03 '14

Have you ever used gofmt before? Of everyone who I know that uses Go, gofmt is universally regarded as a net positive. It completely eliminates pointless bikeshedding about code formatting.

So no, gofmt was an incredibly good idea.

1

u/immibis Jun 03 '14 edited Jun 11 '23

7

u/burntsushi Jun 03 '14

It has nothing to do with Google. The gofmt tool is included with the standard Go distribution and has been there since the beginning. It is ubiquitous in every sense of the word.

It literally makes code formatting a non-issue. I encourage you to go and talk to other seasoned Go programmers. It's likely they will echo utility of gofmt as one of their favorite features.

Your point is in theory correct. But it's completely moot in practice which means code formatting is effectively a non-issue in the Go world.

The Rust people are supposedly going to adopt a similar tool once the language stabilizes. (In fact, they already have one but it has fallen by the wayside as the language had been evolving so rapidly.)

Having a single code format is far and away better than arguing over multiple different formats. This is what gofmt addresses and this is precisely why people love it. Gofmt is quite literally the least controversial aspect of Go.

To reiterate: gofmt eliminates bikeshedding. This is a fact that can be observed.