Range is hardly return-type polymorphic. It always returns the same things, you are just free to ignore them, i.e.
for k := range map { }
is the same thing as
for k, _ := range map { }
Would requiring the second version instead of the first actually be that much of an improvement?
The only true return-type polymorphism is type assertions, which is reasonable in my mind cause I don't think ignoring the "assertion failed" should ever be a logical thing to do.
The only true return-type polymorphism is type assertions, which is reasonable in my mind cause I don't think ignoring the "assertion failed" should ever be a logical thing to do.