第 8 期:泛型来了!
嘉宾:老貘主持:杨文,欧长坤本期摘要:这是 Go 夜聊的第八期节目,我们和 Go 语言 101 的作者一起聊了聊期待已久的泛型,我们聊到了为什么需要泛型,设计的优点、讨论时的期望与正式发布时的失望。新出现的类型集是什么?comparable 又是什么?目前的泛型设计在未来还有多大的改进空间?
时间线
00:12 开场01:10 接触 Go 语言的动机03:30 编写《Go 101》的原因04:42 活跃在 Go 语言社区09:27 独立游戏的行业经历12:11 用 Go 语言做游戏13:51 泛型产生的动机,与 Go Generate 的对比20:21 接口、类型集、类型约束的关系28:36 类型集与泛型的关系30:40 接口与类型集是同一个概念吗?31:34 comparable 类型、它能解决什么问题、它还有哪些争议37:42 接口作为值类型42:45 泛型设计的其他优点48:10 泛型设计的缺点58:09 泛型设计的限制66:09 对泛型未来的期望与失望68:20 Go 团队排外吗?71:35 Go 语言 101 背后的故事83:38 结尾推荐87:55 尾声相关链接
老貘的主页Go 语言 101Go 泛型 101泛型的官方上手教程观点:类型集和接口不等价spec: document definition of comparablespec: any no longer implements comparableproposal: spec: permit values to have type “comparable”proposal: spec: permit non-interface types that support == to satisfy the comparable constraintproposal: spec: allow interface types to instantiate comparable type parametersproposal: spec: add new constraint kind satisfied by types that support == (including interface types)proposal: type parameters are comparable unless they exclude comparable typesproposal: the comparable interface represents the comparable subset of run-time valueshow to update APIs for genericsproposal: spec: allow type parameters in methods追风筝的人灿烂千阳群山回唱理解自由意志AI 新生📝 联系我们
Telegram 听众群