Jul 26, 2017 · 1 min read
I would much rather see Go eliminate globally assignable package exports, where assignable means overwriting the underlying value or replacing an element in index operation. Note: this is not true immutability; that’s not what I am advocating.
The Go ecosystem would see far fewer knock-on effects from a restriction like this. I would hate to see package initializers go away, because the Go specification guarantees their execution per topological sort order of the executable’s import graph. This has immense value for loosely-coupled and composed systems where static registration is a must — e.g., Protocol Buffers and their extensions.
