Hacker News new | ask | show | jobs
by mkhattab 427 days ago
> Go prioritizes not breaking the ecosystem; this allows to assume that Hyrum’s Law will protect certain observable behaviors of the runtime, from which we may infer what can or cannot break easily.

If this assertion is correct, then effectively Go as a language is an evolutionary dead end. Not sure if I would Go fascinating in this case.

4 comments

It's quite a leap from "certain observable behaviors of the runtime" cannot change to Go is a dead-end.

Go regularly makes runtime changes and language changes, see https://go.dev/blog/. Some highlights:

- Iterators, i.e., range-over-function

- Generics

- For loops: fixed variable capture

- Optimized execution tracing

- Changing the ABI from stack-based to register-based.

They introduced generics into the language whilst maintaining compatibility and breaking changes between language versions is painful in large code bases.
They also changed maps' iteration order to be random, rather than insertion order.
They broke the foreach loop behavior in 1.22, mainly to make it match what people expected.

https://go.dev/blog/loopvar-preview

Small, but significant point: you can easily avoid the new behavior. IIRC, if you had a pre-1.22 project, and didn't change anything, it still compiles as before. So if you relied on that behavior (which would be very weird, but who knows), backwards compatibility is still there for you.
It defaults to the new behavior. If you want the old behavior, you had to set a flag on the compiler. But this applies to all code, so any libraries you include would also get whatever behavior you set on the flag.