Re:What makes you enjoy Go lang?
by rcme on Tuesday April 25, 2023 @02:43PM
(#35704848)
.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.
[ Parent
| on HN ]
Re:What makes you enjoy Go lang?
by hakanderyal on Wednesday April 26, 2023 @04:03PM
(#35719222)
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.