虽然这个看起来很简单,但我直接看傻了,各种内置类型和全局函数为啥是这样的啊,只有声明没有定义是什么情况啊。这个问题先留在这里,我知道一定在其他地方。贴出部分恐怖
package builtin
// bool is the set of boolean values, true and false.
type bool bool
// true and false are the two untyped boolean values.
const (
true = 0 == 0 // Untyped bool.
false = 0 != 0 // Untyped bool.
)
// uint8 is the set of all unsigned 8-bit integers.
// Range: 0 through 255.
type uint8 uint8
// uint16 is the set of all unsigned 16-bit integers.
// Range: 0 through 65535.
type uint16 uint16
// uint32 is the set of all unsigned 32-bit integers.
// Range: 0 through 4294967295.
type uint32 uint32
// uint64 is the set of all unsigned 64-bit integers.
// Range: 0 through 18446744073709551615.
type uint64 uint64
顺便一说,原来还有 println
这种全局函数的。实现当然和 fmt.Println
不一样。
再顺便,这个包解决了困扰很久的疑惑之 rune
类型
// src/buildin/buildin.go ---- line 90
// rune is an alias for int32 and is equivalent to int32 in all ways. It is
// used, by convention, to distinguish character values from integer values.
type rune = int32
藏不住了吧,你就只是个 int32
而已,装什么神秘呢。