Description
The new method reflect.Value.CanConvert
is a likely accept in #46746. If the acceptance becomes final as expected, I would like to request a freeze exception for https://golang.org/cl/334669 to add the method to the Go 1.17 release. Go 1.17 is the first release to permit a conversion that can panic dynamically (converting from a slice to a pointer-to-array if the slice is too short). Without reflect.Value.CanConvert
, people using the reflect package must write awkward code to ensure that calls to reflect.Value.Convert
do not panic even if reflect.Type.ConvertibleTo
return true.
I believe this CL is safe for 1.17 even at this late stage as it only adds a new method. It does not change any existing code. It can't break any existing program.
CC @rsc @josharian @golang/release