Go(2) Language Basic

Part2. Language Basic 1. Function 1 2 3 4 type funcval struct { fn uintptr // variable-size, fn-specific data here } funcval使用二级指针,可以处理闭包(1.外部定义,内部引用的自由变量 2.脱离闭包上下文也能保留这些变量) ...

Sep 14, 2021 · 8 min · Chasing1020

Go(1) Builtin Data Structure

Part1. Builtin Data Structure 0. Type 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 package builtin type bool bool const ( true = 0 == 0 // Untyped bool. false = 0 != 0 // Untyped bool. ) type uint8 uint8 type uint16 uint16 type uint32 uint32 type uint64 uint64 type int8 int8 type int16 int16 type int32 int32 type int64 int64 type float32 float32 type float64 float64 type complex64 complex64 type complex128 complex128 type string string type int int type uint uint type uintptr uintptr // byte is an alias for uint8 and is equivalent to uint8 in all ways. type byte = uint8 // rune is an alias for int32 and is equivalent to int32 in all ways. type rune = int32 const iota = 0 // Untyped int. // nil is a predeclared identifier representing the zero value for a // pointer, channel, func, interface, map, or slice type. var nil Type // Type must be a pointer, channel, func, interface, map, or slice type type Type int type Type1 int type IntegerType int type FloatType float32 type ComplexType complex64 func append(slice []Type, elems ...Type) []Type func copy(dst, src []Type) int func delete(m map[Type]Type1, key Type) func len(v Type) int func cap(v Type) int func make(t Type, size ...IntegerType) Type func new(Type) *Type func complex(r, i FloatType) ComplexType func real(c ComplexType) FloatType func imag(c ComplexType) FloatType func close(c chan<- Type) func panic(v interface{}) func recover() interface{} func print(args ...Type) func println(args ...Type) type error interface { Error() string } 对于类型的定义: ...

Sep 02, 2021 · 12 min · Chasing1020

Go(0) Compilers Principles

Part0. Compilers Principles 1. Stage 编译器技术影响了计算机的体系结构,同时也受到体系结构发展的影响。 体系结构的很多现代创新都依赖于编译器能从源程序中抽取出有效利用硬件能力的机会。 ...

Aug 26, 2021 · 11 min · Chasing1020

Python Note

第一章——基础知识 1、模块的引入 1 2 3 4 5 6 7 8 9 10 11 12 #demo: # 随机数 #导入import 模块 import random a=random.randint(1,5) #a最终被赋值为1,2,3,4,5之间的随机一个数,左闭右闭 #这里包括1和5! 2、数据类型 1 2 3 4 5 6 7 8 9 10 11 #type() 获取信息 #例如 a='520.0' b=float(a) type(a)#输出<class 'str'> type(b)#输出<class 'float'> #函数isinstance(var,class) #对比前后类型 isinstance(10,int)#输出True 强制类型转换 ...

Oct 06, 2020 · 14 min · Chasing1020