Closed jfcg closed 4 years ago
byte slices and strings are convertable to each other:
var bs = []byte("şevkı") fmt.Println(len(bs), string(bs))
I propose to extend this by allowing to convert:
var ba = [...]byte("şevkı")
var ba = [...]byte{20, 40, 60} var s = string(ba)
Also:
// should not compile var ba = [6]byte("şevkı")
// ok var ba = [7]byte("şevkı")
// pad with zeros var ba = [8]byte("şevkı")
I believe this is backward-compatible with Go 1. What do you think?
No change in consensus.
Change https://golang.org/cl/245099 mentions this issue: compiler,runtime: pass only ptr and len to some runtime calls
compiler,runtime: pass only ptr and len to some runtime calls
byte slices and strings are convertable to each other:
I propose to extend this by allowing to convert:
Also:
// ok var ba = [7]byte("şevkı")
// pad with zeros var ba = [8]byte("şevkı")