Live data from Hacker News

What makes you enjoy Go lang?

news.ycombinator.com

41–44 of 44 posts

Re: What makes you enjoy Go lang?

#42

--I like the tabs. Tabs let everyone see the indent width they prefer. Some people get eye strain with indent width 2. This is why spaces are evil. Using spaces for indent is like hard coding the color-theme of the editor into your code file. It's simply wrong. Tabs are perfection. --I like the tooling surrounding it. LSP server. code formatter gofmt. Build tools to X-compile for anything. --I like the C-style error…

Forgot one.

--I like how Go fills this little niche that no one else quite fills. Combining garbage collection while defaulting to value types. A savvy programmer has a lot of leeway to avoid creating garbage, while still "feeling" like Javascript.

Sure other languages are even better for avoiding garbage, but they also don't have the care-free feeling of JavaScript. Or they might feel care free but are living in Heap City.

Re: What makes you enjoy Go lang?

#43
post #33
post #29

Earlier quoted context omitted.

.NET has System.Text.Json. I wonder how does it compare to go's implementation

.NET is ok, but the classes you make serializable generally aren't how you'd write a normal class, which is what I mean by "ergonomic." As far as I know, you need your fields to be public for both reads and writes, and you need to write a separate constructor if you want to create the types programmatically. Go lets you serialize objects more-or-less how you'd write them without serialization, as does Kotlin.

Record types introduced in C# 9 solves this.

It's now as simple as

record SomeData(string Name, int Id);

Which gives you an immutable object, auto generated constructor, and some additional helpers to make life easier.

Post reply on HN