Why is rune in golang an alias for int32 and not uint32?

go

Solution

I googled and found this

This has been asked several times. rune occupies 4 bytes and not just one because it is supposed to store unicode codepoints and not just ASCII characters. Like array indices, the datatype is signed so that you can easily detect overflows or other errors while doing arithmetic with those types.

Problem

The type `rune` in Go is defined as an alias for `int32` and is equivalent to `int32` in all ways. It is used, by convention, to distinguish character values from integer values. If the intention is to use this type to represent character values, why did the authors of the Go language do not use `uint32` instead of `int32`? How do they expect a `rune` value to be handled in a program, when it is negative? The other similar type, `byte`, is an alias for `uint8` (and not `int8`), which seems reasonable.

Original source

Related problems