编程语言与软件工程2019fsharp.org
F# 的早期历史
The Early History of F#
入门 · 约 45 分钟读完前置知识:函数式编程基础、.NET 平台了解
导读
这篇论文由 F# 之父 Don Syme 撰写,回顾了在尚未开源的微软内部将一门函数式语言(ML 风格)移植到 .NET 平台的历史,包括其中的目标设定与各种权衡取舍。文章还指出,自 2007 年前后,强类型函数式编程已从小众走向主流,C#、Java、Rust、Swift、TypeScript 等语言都吸收了相关特性。
HN 关注点:Don Syme 亲述 F# 的诞生史,加上众多开发者分享从 C#/Java 迁移到 F# 的生产力体验,引发了关于函数式编程价值与语言设计权衡的讨论。
后来怎么样
F# 成为 .NET 平台上的主流函数式语言,其设计推动了 async/await 等特性进入 C# 和其他主流语言,强类型函数式编程被广泛吸收进 Java、Rust、Swift、TypeScript 等语言。
HN 评论精选
这几条评论里:支持 1 补充 1 亲历 2
支持称赞文章坦诚,F# 表达领域模型简洁清晰,遗憾没早点学 ML 语言
Don Syme 这篇回顾写得非常有趣且坦诚,讲述了在开源前的微软内部实现 .NET 函数式语言所需的目标与权衡。我用 F# 处理一切关键或复杂的项目——它是表达领域模型和计算逻辑的简洁清晰的方式。我唯一的遗憾是职业生涯中没有更早接触 ML 系语言。另外推荐新书《Stylish F#》,是我读过最好的 F# 入门书。
mamp查看英文原文
A really interesting and honest write up by Don Syme on the goals and trade-offs required to get a functional language implemented on .Net, in pre-open Microsoft. I use F# for anything critical and/or complex. It's a parsimonious way to represent domain models and a clear way to express computation. My main regret with F# is that I didn't get into ML languages earlier in my career. BTW a recent book, 'Stylish F#', is the best introduction to F# so far (no affiliation, just bought a lot of F# books over the years). https://www.apress.com/gp/book/9781484239995
亲历从 C# 迁移到 F#,代码量约省 1/3,视其为竞争优势
我正在把自动化助手项目从 C# 逐步迁移到 F#,唯一的遗憾同样是没早点动手。函数式语言能极其精确简洁地表达逻辑,我估计每个 F# 模块的代码量约为 C# 等价实现的 2/3,且所有内容可整合进单个文件。F# 也有怪癖(作为语言我觉得 Clojure 更干净),但 .NET 互操作是巨大优势。某种程度上我不想太推广它,感觉像是发现了对竞争对手的隐藏优势。
avinium查看英文原文
I've been slowly migrating from C# to F# for our automation assistant (https://lexico.io - not yet usable yet but will be soon), and like the top comment here, my only regret is that I didn't do so sooner. Functional languages allow logic to be expressed so precisely and concisely. I hazard a guess that every F# module is 2/3 the LOC of its C# equivalent, with the added advantage that everything is incorporated into a single file. F# certainly has its quirks (as a language, I think Clojure is actually cleaner - but that comes with the downsides of the JVM and .NET interop is a huge advantage). Part of me doesn't want to spread it around too much, because I feel like I've discovered some hidden edge over my hypothetical competitors.
亲历用 F# 重写 Java 项目,生产力提升巨大,称其为秘密武器
我们正在用 F# 重写 Buckaroo(之前是现代 Java)。生产力提升巨大……FParsec、async、asyncSeq、record、match 表达式都远超大多数 OOP 语言。得益于 Core RT,部署也容易多了。F# 感觉像一件秘密武器。
adgasf查看英文原文
We are currently rewriting Buckaroo in F# (https://github.com/LoopPerfect/buckaroo/tree/buckaroo-redux ); previous versions were in modern Java. The productivity gains are tremendous... FParsec, async, asyncSeq, records, match expressions are all a huge leap over what most OOP languages offer. Deployments are also much easier thanks to Core RT. F# feels like a secret weapon.
补充感慨函数式编程特性被主流语言吸收的过程走了弯路
引用论文:'自 2007 年前后,强类型函数式编程已从相对冷门转变为编程的核心范式。C#、Java、C++、Scala、Kotlin、Swift、Rust 和 TypeScript 现在都包含了强类型 FP 的元素……这在 2005 年是不可想象的。' 我们感觉是绕了远路才让函数式编程流行起来。
melling查看英文原文
“Since around 2007 strongly-typed functional programming has shifted from relative obscurity to be a central paradigm in programming. C#, Java, C++, Scala, Kotlin, Swift, Rust and TypeScript now all include elements of strongly-typed FP, and Apple executives extolled functional features at the launch of Swift in 2014, including pattern matching, generics, option types, type inference, tuples and closures, something unthinkable in 2005.93 Haskell, F# and OCaml have all grown in use, and newcomers such as Elm and ReasonML are also finding good adoption.” I feel like we’ve taken the long way to popularize functional programming.
相关资源
从这篇论文所有 HN 讨论帖的全部评论里整理出来的链接。
历次讨论
- 2019Hacker News 讨论帖147 分 · 53 评
同领域还值得读
Google 的软件工程(2017)
Software Engineering at Google (2017)
介绍了 Google 的软件工程实践,包括其单一代码库(monorepo)、几乎全部开发在主干进行而非分支、代码审查、构建系统 Blaze、协议缓冲区等工具与流程,并讨论了频繁重…
编程语言与软件工程2017 · 1,127 分 · 465 评 · 引用 15入门 · 约 45 分钟编辑精选Peter Naur:编程作为理论构建 (1985)
Peter Naur – Programming as Theory Building (1985)
Peter Naur 1985 年的经典论文《Programming as Theory Building》提出:编程的本质不是写代码或文档,而是在程序员头脑中构建对程序及其运行…
编程语言与软件工程2016 · 629 分 · 74 评入门 · 约 45 分钟编辑精选SciPy 1.0:Python 科学计算的基础算法
SciPy 1.0: fundamental algorithms for scientific computing in Python
这篇发表于 Nature Methods 的论文介绍了 SciPy 1.0——Python 科学计算生态的基石库,涵盖其核心算法模块(优化、积分、插值、线性代数等)、软件架构与社…
编程语言与软件工程2020 · 387 分 · 98 评入门 · 约 45 分钟编辑精选Lisp 的历史(1979)
History of Lisp (1979)
这是 Lisp 发明者 John McCarthy 于 1979 年为 HOPL(编程语言史)会议撰写的回顾文章,讲述 Lisp 的起源、设计动机与早期演进,文中也涉及 if 表…
编程语言与软件工程2018 · 352 分 · 44 评入门 · 约 45 分钟编辑精选使用 NumPy 进行数组编程
Array Programming with NumPy
这篇 Nature 文章介绍 NumPy 的数组编程模型及其在科学计算中的核心作用:以 ndarray 为中心,通过向量化操作让 Python 高效处理多维数组。
编程语言与软件工程2020 · 318 分 · 134 评入门 · 约 40 分钟编辑精选