arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2307.07069cs.PL
收藏

函数式时代的类型化设计模式

Typed Design Patterns for the Functional Era

Will Crichton

AI总结:

本文面向主流函数式编程重新界定设计模式,提出 Witness、State Machine、Parallel Lists 和 Registry 四个类型化模式,并以 Rust 展示如何借助类型系统在编译期防止领域建模错误。

摘要:

本文探讨在主流函数式编程语言时代应如何重新审视设计模式。我讨论了哪些知识应被表示为函数式设计模式:那些相对自包含,但其整体无法作为语言级抽象来表示的架构概念。我给出了体现这一思想的四个具体示例:Witness、State Machine、Parallel Lists 和 Registry。每种模式都使用 Rust 实现,以展示如何谨慎利用精密的类型系统,更好地为各个领域构造建模,从而在编译期捕获用户错误。

英文摘要:

This paper explores how design patterns could be revisited in the era of mainstream functional programming languages. I discuss the kinds of knowledge that ought to be represented as functional design patterns: architectural concepts that are relatively self-contained, but whose entirety cannot be represented as a language-level abstraction. I present four concrete examples embodying this idea: the Witness, the State Machine, the Parallel Lists, and the Registry. Each pattern is implemented in Rust to demonstrate how careful use of a sophisticated type system can better model each domain construct and thereby catch user mistakes at compile-time.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑