I recently tried to use the new #395 feature (for converting a slice to an array pointer: https://golang.org/cl/216424) in:
https://go-review.googlesource.com/c/go/+/322329
But in review, it was pointed out that it was a little ugly, as what I wanted to return was an array, which required a dereference:
return *(*[Size224]byte)(sum[:Size224])
It would've been nicer if I could've just converted to an array instead:
return ([Size224]byte)(sum[:Size224])
Talking to @ianlancetaylor and @griesemer, we couldn't remember great reasons for not also allowing this as part of #395. It does mean there's an subtle copy, but arguably the * dereference above is also a somewhat subtle copy.
Could we also add support for converting to the array?
/cc @katiehockman @josharian @rogpeppe @mdempsky
I recently tried to use the new #395 feature (for converting a slice to an array pointer: https://golang.org/cl/216424) in:
https://go-review.googlesource.com/c/go/+/322329
But in review, it was pointed out that it was a little ugly, as what I wanted to return was an array, which required a dereference:
It would've been nicer if I could've just converted to an array instead:
Talking to @ianlancetaylor and @griesemer, we couldn't remember great reasons for not also allowing this as part of #395. It does mean there's an subtle copy, but arguably the
*dereference above is also a somewhat subtle copy.Could we also add support for converting to the array?
/cc @katiehockman @josharian @rogpeppe @mdempsky