diff options
Diffstat (limited to 'src/pkg/builtin/builtin.go')
-rw-r--r-- | src/pkg/builtin/builtin.go | 104 |
1 files changed, 98 insertions, 6 deletions
diff --git a/src/pkg/builtin/builtin.go b/src/pkg/builtin/builtin.go index 07acce4f7..e81616ca4 100644 --- a/src/pkg/builtin/builtin.go +++ b/src/pkg/builtin/builtin.go @@ -3,29 +3,110 @@ // license that can be found in the LICENSE file. /* - Package builtin provides documentation for Go's built-in functions. - The functions documented here are not actually in package builtin + Package builtin provides documentation for Go's predeclared identifiers. + The items documented here are not actually in package builtin but their descriptions here allow godoc to present documentation - for the language's special functions. + for the language's special identifiers. */ package builtin +// bool is the set of boolean values, true and false. +type bool 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 + +// int8 is the set of all signed 8-bit integers. +// Range: -128 through 127. +type int8 int8 + +// int16 is the set of all signed 16-bit integers. +// Range: -32768 through 32767. +type int16 int16 + +// int32 is the set of all signed 32-bit integers. +// Range: -2147483648 through 2147483647. +type int32 int32 + +// int64 is the set of all signed 64-bit integers. +// Range: -9223372036854775808 through 9223372036854775807. +type int64 int64 + +// float32 is the set of all IEEE-754 32-bit floating-point numbers. +type float32 float32 + +// float64 is the set of all IEEE-754 64-bit floating-point numbers. +type float64 float64 + +// complex64 is the set of all complex numbers with float32 real and +// imaginary parts. +type complex64 complex64 + +// complex128 is the set of all complex numbers with float64 real and +// imaginary parts. +type complex128 complex128 + +// string is the set of all strings of 8-bit bytes, conventionally but not +// necessarily representing UTF-8-encoded text. A string may be empty, but +// not nil. Values of string type are immutable. +type string string + +// int is a signed integer type that is at least 32 bits in size. It is a +// distinct type, however, and not an alias for, say, int32. +type int int + +// uint is an unsigned integer type that is at least 32 bits in size. It is a +// distinct type, however, and not an alias for, say, uint32. +type uint uint + +// uintptr is an integer type that is large enough to hold the bit pattern of +// any pointer. +type uintptr uintptr + +// byte is an alias for uint8 and is equivalent to uint8 in all ways. It is +// used, by convention, to distinguish byte values from 8-bit unsigned +// integer values. +type byte byte + +// rune is an alias for int and is equivalent to int in all ways. It is +// used, by convention, to distinguish character values from integer values. +// In a future version of Go, it will change to an alias of int32. +type rune rune + // Type is here for the purposes of documentation only. It is a stand-in // for any Go type, but represents the same type for any given function // invocation. type Type int +// Type1 is here for the purposes of documentation only. It is a stand-in +// for any Go type, but represents the same type for any given function +// invocation. +type Type1 int + // IntegerType is here for the purposes of documentation only. It is a stand-in // for any integer type: int, uint, int8 etc. type IntegerType int // FloatType is here for the purposes of documentation only. It is a stand-in // for either float type: float32 or float64. -type FloatType int +type FloatType float32 // ComplexType is here for the purposes of documentation only. It is a // stand-in for either complex type: complex64 or complex128. -type ComplexType int +type ComplexType complex64 // The append built-in function appends elements to the end of a slice. If // it has sufficient capacity, the destination is resliced to accommodate the @@ -43,6 +124,11 @@ func append(slice []Type, elems ...Type) []Type // len(src) and len(dst). func copy(dst, src []Type) int +// The delete built-in function deletes the element with the specified key +// (m[key]) from the map. If there is no such element, delete is a no-op. +// If m is nil, delete panics. +func delete(m map[Type]Type1, key Type) + // The len built-in function returns the length of v, according to its type: // Array: the number of elements in v. // Pointer to array: the number of elements in *v (even if v is nil). @@ -95,7 +181,7 @@ func complex(r, i FloatType) ComplexType // The return value will be floating point type corresponding to the type of c. func real(c ComplexType) FloatType -// The imaginary built-in function returns the imaginary part of the complex +// The imag built-in function returns the imaginary part of the complex // number c. The return value will be floating point type corresponding to // the type of c. func imag(c ComplexType) FloatType @@ -133,3 +219,9 @@ func panic(v interface{}) // nil. Thus the return value from recover reports whether the goroutine is // panicking. func recover() interface{} + +// The error built-in interface type is the conventional interface for +// representing an error condition, with the nil value representing no error. +type error interface { + Error() string +} |