5 ms·
Such a feature would probably require golang to either implement annotations or a new keyword. I'm not sure golang doesn't have annotations, but probably for
by WatchDog 5y ago
Such a feature would probably require golang to either implement annotations or a new keyword.
I'm not sure golang doesn't have annotations, but probably for the same reasons it's taken so long to implement generics, it's a language stuck in the 70's, with a user base and leadership that will fight tooth and nail to try and stay that way.
- Kon-Peki 5y agoGo most definitely allows annotations on structure fields [1]. You say the language is stuck in the 70s, but the GP has a quote from the Go authors saying that having the compiler reorder structure fields is a 1970s problem... Well anyway, mostly it just sounds like the typical Rust enthusiast "How dare you have a strongly-held opinion that differs from my strongly-held opinion". As someone who used to work on a codebase that had to be portable across X86, Alpha, SPARC, and Itanium, paying attention to structure field order quickly becomes a routine matter. It hardly seems worthy of an argument over the merits of a programming language. [1] https://pkg.go.dev/reflect#StructTag https://pkg.go.dev/reflect#StructTag
- adwn 5y ago> Well anyway, mostly it just sounds like the typical Rust enthusiast "How dare you have a strongly-held opinion that differs from my strongly-held opinion" To the contrary, it sounds like "Here's a solution that gives better results in 99% of cases, for reasons X, Y, Z, and better control and guarantees in those other 1% of cases."
- Ar-Curunir 5y agoNo need to be defensive, I was merely suggesting one approach, and didn't even criticize Go anywhere in my comment.
- rsecora 5y agoIts not really a 70s problem, its a solution to a problem if the 1970s. RISC machines raised bus error if not properly aligned to avoid "double" access to the same value. https://en.wikipedia.org/wiki/Bus_error#Unaligned_access https://en.wikipedia.org/wiki/Bus_error#Unaligned_access
- masklinn 5y ago> I'm not sure golang doesn't have annotations It does, the `//go:` stricture is a pragma / annotation. And though I don’t remember any being at the struct-definition level, Go 1.16 added one at the “const” (toplevel var) level so adding it for structs doesn’t seem like an issue.
- geodel 5y ago> with a user base and leadership that will fight tooth and nail to try and stay that way. This is hilarious. If majority users and authors of language all like same thing then for whom this problem is to be fixed in general? Is it for non-users of Go?