For a change to be breaking it needs the potential to be able to break. As the potential approaches zero, so too does the coefficient of breakage.
For a change to be breaking it needs the potential to be able to break. As the potential approaches zero, so too does the coefficient of breakage.
for i, p := 0, (*int)(nil); p == nil; print(p == &i) {
p = &i
}
Another surprise is that the value a in the following loop will be duplicated twice in each loop step (now it never gets duplicated). func foo(constFunc func(*[100000]int)) {
for a, i := [100000]int{}, 0; i < len(a); i++ {
constFunc(&a)
}
}The examples you share are in the proposal discussion, so there is little value in rehashing your apparently bad-faith argument here. It's not a breaking change if nothing breaks.
Go is and has always strived to be pragmatic. This is an incredibly pragmatic approach to solving a real problem. Being pedantic about this actually breaking a theoretical program which either makes no sense or doesn't exist does not add value to a proposal which already addresses this concept very well from the onset.
Obviously you can write it like that, my point is that it's not clear to me people actually are writing code like that. "If a footgun is never encountered then is it really a footgun?"