类型系统中的反例 (2021)
摘要
一个精心收集的反例合集,展示了类型系统的局限性和陷阱,作为程序员和语言设计者的教育资源。
暂无内容
查看缓存全文
缓存时间: 2026/06/30 21:39
# 类型系统中的反例 - 类型系统中的反例
来源:https://counterexamples.org/
1. 类型系统中的反例 (https://counterexamples.org/title.html)
2. 引言 (https://counterexamples.org/intro.html)
3. 索引与词汇表 (https://counterexamples.org/glossary.html)
4. **1\.**多态引用 (https://counterexamples.org/polymorphic-references.html)
5. **2\.**协变容器 (https://counterexamples.org/general-covariance.html)
6. **3\.**不完全的变体检查 (https://counterexamples.org/incomplete-variance.html)
7. **4\.**构造中的对象 (https://counterexamples.org/under-construction.html)
8. **5\.**柯里悖论 (https://counterexamples.org/currys-paradox.html)
9. **6\.**最终,虚无 (https://counterexamples.org/eventually-nothing.html)
10. **7\.**可疑的证据 (https://counterexamples.org/dubious-evidence.html)
11. **8\.**某种类型的“任意值” (https://counterexamples.org/anythings.html)
12. **9\.**任意(单个)事物 (https://counterexamples.org/anything-once.html)
13. **10\.**可变匹配 (https://counterexamples.org/mutable-matching.html)
14. **11\.**运行时类型信息误导 (https://counterexamples.org/runtime-misinformation.html)
15. **12\.**重载与多态 (https://counterexamples.org/overloading-polymorphism.html)
16. **13\.**区别性 I:单射性 (https://counterexamples.org/distinctness-injectivity.html)
17. **14\.**区别性 II:递归 (https://counterexamples.org/distinctness-recursion.html)
18. **15\.**区别性 III:选项 (https://counterexamples.org/distinctness-options.html)
19. **16\.**子类型与继承 (https://counterexamples.org/subtyping-vs-inheritance.html)
20. **17\.**自私性 (https://counterexamples.org/selfishness.html)
21. **18\.**隐私侵犯 (https://counterexamples.org/privacy-violation.html)
22. **19\.**不稳定的类型表达式 (https://counterexamples.org/unstable-types.html)
23. **20\.**回避问题 (https://counterexamples.org/avoidance.html)
24. **21\.**知其一隅... (https://counterexamples.org/little-knowledge.html)
25. **22\.**欠确定的递归 (https://counterexamples.org/underdetermined-recursion.html)
26. **23\.**过确定的递归 (https://counterexamples.org/overdetermined-recursion.html)
27. **24\.**作用域逃逸 (https://counterexamples.org/scope-escape.html)
28. **25\.**虚假伪装 (https://counterexamples.org/false-pretenses.html)
29. **26\.**可疑的子项 (https://counterexamples.org/suspicious-subterms.html)
30. **27\.**只有一个莱布尼茨 (https://counterexamples.org/only-one-leibniz.html)
31. **28\.**交叉引用 (https://counterexamples.org/intersecting-references.html)
32. **29\.**多态联合细化 (https://counterexamples.org/polymorphic-union-refinement.html)
33. **30\.**严格与非严格的正性 (https://counterexamples.org/strict-positivity.html)
34. **31\.**近乎全称量化 (https://counterexamples.org/nearly-universal.html)
## 类型系统中的反例
https://counterexamples.org/print.htmlhttps://github.com/stedolan/counterexamples
## 类型系统中的反例 (https://counterexamples.org/#counterexamples-in-type-systems)
*由 Stephen Dolan 整理,感谢 Andrej Bauer、Leo White 和 Jeremy Yallop*
https://counterexamples.org/intro.html
https://counterexamples.org/intro.html
相似文章
新Blub悖论,或者说:为什么TypeScript在AI时代是一个糟糕的选择
认为TypeScript由于不健全的类型系统而成为AI时代的一个糟糕默认选项,它无法捕获AI生成的代码中的错误,并将其比作Paul Graham的Blub悖论。
擦除存在类型
深入探讨 Rust 类型系统中的存在量词,比较 `dyn Trait` 和 `impl Trait`,并探索超越 `Self` 的存在量化类型变量的高级模式。
静态类型与铲子(2026)
作者认为,2010年代静态类型编程的复兴归功于改进的类型系统(例如 TypeScript、Haskell、Rust),这些系统提供了可空类型处理、和类型以及类型推断,与 Java 和 C++98 等早期语言中糟糕的静态类型形成对比。
无类型检查的生命周期借用检查
一篇博客文章介绍了一种玩具语言,它在运行时而非静态类型系统中强制执行借用检查,通过在栈上使用轻量级引用计数来支持内部指针和单一所有权,适用于动态类型环境。
结构正确性
一篇技术博客文章,讨论类型系统和构建系统等结构描述如何利用图结构模型来确保正确性,并强调像Bazel这样的系统的定义性本质。