Go 2 Generics? A (P)review## Go 2 Generics? A (P)review ## Changkun Ou  https://changkun.de/s/go2generics/ https://youtu.be/E16Y6bI2S08 Go 夜读 SIG SIG 小组 | 第 80 期 March 18, 2020 ## 主要内容 - 泛型的起源 - 泛型的早期设计 - Go 2 的「合约」 - 上手时间 - 历史性评述 - 展望 ## 泛型的起源 Origin of Generics 多态是同一形式表现出不同行为的一种特性。在编程语言理论中被分为两类: 临时性多态(Ad hoc Polymorphism)根据实参类型调 + b } func Add(a, b float64) float64 { return a + b } // 注意:Go 语言中不允许同名函数 Add(1, 2) // 调用第一个 Add(1.0, 2.0) // 调用第二个 Add("1", "2") // 编译时不检查,运行时找不到实现,崩溃 参数化多态(Parametric Polymorphism)0 码力 | 41 页 | 770.62 KB | 2 年前3
Adventures in SIMD Thinking (Part 2 of 2)## Adventures in SIMD Thinking (Part 2 of 2) Bob Steagall CppCon 2020 ## KEWB COMPUTING ## Agenda • Learn a little about Intel's SIMD facilities (disclaimer: I don't work for Intel) • Create median-of-seven filter • Fast small-kernel convolution • Faster (?) UTF-8 to UTF-32 conversion (with AVX2) ## • No heavy code, but lots of pictures • Thinking "vertically" ## Small-Kernel Convolution 907b5ac183397899fe79b53265/p4_2.jpg) ## Convolution $$ S_{ 冮 }= 冮 s\theta $$ $$ \mathsf{K}=\mathsf{k}\emptyset $$ $$ k1 $$ $$ \begin{aligned}&s2\\&k2\end{aligned} $$ $$ s3 $$ S40 码力 | 135 页 | 551.08 KB | 1 年前3
Go 入门指南(The way to Go)Go入门指南 书栈(BookStack.CN) ## 目录 致谢 阅前必读 内容介绍 前言 第1章:Go 语言的起源,发展与普及 1.1 起源与发展 1.2 语言的主要特性与发展的环境和影响因素 第2章:安装与运行环境 2.1 平台与架构 2.2 Go 环境变量 2.3 在 Linux 上安装 Go 2.4 在 Mac OS OS X 上安装 Go 2.5 在 Windows 上安装 Go 2.6 安装目录清单 2.7 Go 运行时(runtime) 2.8 Go 解释器 第3章:编辑器、集成开发环境与其它工具 3.1 Go 开发环境的基本要求 3.2 编辑器和集成开发环境 3.3 调试器 3.4 构建并运行 Go 程序 3.5 格式化代码 3.6 生成代码文档 3 3.7 其它工具 3.8 Go 性能说明 3.9 与其它语言进行交互 第4章:基本结构和基本数据类型 4.1 文件名、关键字与标识符 4.2 Go 程序的基本结构和要素 4.3 常量 4.4 变量 4.5 基本类型和运算符 4.6 字符串 4.7 strings 和 strconv 包 4.8 时间和日期 4.9 指针 第5章:控制结构0 码力 | 466 页 | 4.44 MB | 2 年前3
Go 入门指南(The way to Go)1986bf1/p1_3.jpg) The Way to Go Go入门指南 Ivo Balbaert 著 陈佳桦 译 ## 前言 原文出处:https://github.com/Unknwon/the-way-to-go_ZH_CN ## 用更少的代码,更短的编译时间,创建运行更快的程序,享受更多的乐趣 对于学习 Go 编程语言的爱好者来说,这本书无疑是最适合你的一本书籍,这里包 开发出的软件能够很好地在现代的多核计算机上工作 - 开发出的软件能够很好地在网络环境下工作 • 使人们能够享受软件开发的过程 Go 语言就在这样的环境下诞生了,它让人感觉像是 Python 或 Ruby 这样的动态语言,但却又拥有像 C 或者 Java 这类语言的高性能和安全性。 Go 语言出现的目的是希望在编程领域创造最实用的方式来进行软件开发。它并不是要用奇怪的语法和晦涩难懂的概念来从根本上推翻已有的编程语言,而是建立并改善了 来支持并发和并行编程。 这本书是为那些想要学习 Go 这门全新的,迷人的和充满希望的编程语言的开发者量身定做的。当然,你在学习 Go 语言之前需要具备一些关于编程的基础知识和经验,并且拥有合适的学习环境,但你并不需要对 C 或者 Java 或其它类似的语言有非常深入的了解。 对于那些熟悉 C 或者面向对象编程语言的开发者,我们将会在本书中用 Go 和一些编程语言的相关概念进行比较(书中会使用大家所熟知的缩写0 码力 | 380 页 | 2.97 MB | 2 年前3
1.3 Go coding in go waythe way you think about programming is not worth knowing.”- Alan J. Perlis(艾伦·佩利),首届图灵奖得主 问题:素数筛 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 用Eratosthenes’ sieve(埃拉托斯特尼)算法(https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes)。 算法描述:先用最小的素数2去筛,把2的倍数剔除掉;下一个未筛除的数就是素数(这里是3)。再用这个素数3去筛,筛除掉3的倍数…这样不断重复下去,直到筛完为止。 sieve.c//基于数组的内存操作 void sieve() { $ sieve [2..n] [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97] sieve.go//并发组合 (borrowed from Rob Pike’s slide) func generate(ch chan<- int) { for i := 2; ; i++ {0 码力 | 69 页 | 1.24 MB | 1 月前3
Back to Basics: Designing Classes (part 2 of 2)(part 2 of 2) ## KLAUS IGLBERGER 20 21 October 24-29 C++ Trainer/Consultant Author of the bl $ \text{ze} $ C++ math library (Co-)Organizer of the Munich C++ user group Chair of the CppCon B2B and Email: klaus.iglberger@gmx.de  Klaus Iglberger ## Content ## Back to Basics: Class Design (Part 1) The Challenge of Class Testability Implementation Guidelines Resource Management ## Back to Basics: Class Design (Part 2) Implementation Guidelines Data Member Initialization Implicit Conversions Order of Data Members0 码力 | 76 页 | 2.60 MB | 1 年前3
Go vs. GoPlus(Go+)## GCN ### Go vs. GoPlus(Go+)  许式伟 x@goplus.org 2021-6-27 北京 ## 话外:模板 ## Go 篇 ## 谁是最成功的语言? • 1970 – 至今 - 什么语言是最成功的 什么语言是最成功的? • C (1970) • C++ (1979) • Objective-C (1986) • Java (1994) • C# (2002) • Go (2009)  |Position Aug 2012|Position Aug Position|Programming Language|Ratings Aug 2012|Delta Aug 2011|Status| |---|---|---|---|---|---|---| |1|2|↑|C|18.937%|+1.55%|A| |2|1|↓|Java|16.352%|-3.06%|A| |3|6|↑↑↑|Objective-C|9.540%|+4.05%|A| |4|3|↓|C++|9.333%|+0.90%|A|0 码力 | 54 页 | 1.82 MB | 2 年前3
The Go Handbook## GO HANDBOOK # Table of Contents Preface The Go Handbook Conclusion ## Preface The Go Handbook follows the 80/20 rule: learn in 20% of the time the 80% of a topic. In particular, the goal is to to get you up to speed quickly with Go. This book is written by Flavio Copes. I publish programming tutorials on my blog flaviocopes.com and I organize a yearly bootcamp at bootcamp.dev. You can reach @flaviocopes. Enjoy! ## The Go Handbook • 1. Preface • 2. Getting started with Go • 3. Install Go • 4. Setup your editor • 5. Hello, World! • 6. Compiling and running the Go program • 7. The workspace0 码力 | 44 页 | 4.30 MB | 2 年前3
Exporting Go## Exporting Go Robert Griesemer GopherCon Singapore, 2017 ## I ntro ## • Go package o Namespace Interface (export) o Import ## • Implementation ☐ Export/import (this talk) ☐ Linker (not this example 1 == 1 2 == 2 prime 3 == 3 prime 4 == 2^2 5 == 5 prime 6 == 2 * 3 7 == 7 prime 8 == 2^3 9 == 3^2 10 == 2 * 5 11 == 11 prime 12 == 2^2 * 3 ... 996 == 2^2 * 3 * 83 997 == 997 prime 998 == 2 * 499 999 999 == 3^3 * 37 1000 == 2^3 * 5^3 ## Go package main import "fmt" type List struct { Factor, Power int Link *List } func Factor(x int) *List { ... } // returns the list of prime factors0 码力 | 34 页 | 2.29 MB | 2 年前3
The Expressiveness of Go/fbc8faeb9182189853827de4c2f92561/p1_1.jpg) ## The Expressiveness of Go Rob Pike JAOO Oct 5, 2010  http://golang.org org Google  ## Team Russ Cox Robert Griesemer Rob Pike Ian Taylor Ken Thompson plus David Symonds, Nigel Tao, Andrew Why Why a new language?  ## Why Go? A response to Google’s internal needs: - efficient large scale programming - speed0 码力 | 49 页 | 839.26 KB | 2 年前3
共 1000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 100













