我在这里看到很多关于函数式语言的讨论。为什么你要使用传统语言而不是传统语言呢?他们在哪些方面做得更好?他们更不擅长什么?理想的函数式编程应用程序是什么?


当前回答

我个人认为,对于分布式系统和多线程/并行编程,函数式编程将很快取得突破。只要它通过编程库与现有的OOP范式集成。所以…在我看来,纯功能的方法仍将停留在学术上。

其他回答

为什么函数式编程很重要

它之所以流行起来,是因为它是控制复杂性的最佳工具。 看到的: ——西蒙·佩顿-琼斯演讲《哈斯凯尔的味道》幻灯片109-116 ——Tim Sweeney的《下一个主流编程语言:游戏开发者的视角

如果一个人看不到其他艺术的价值,他就无法理解他所选择的艺术的完美和不完美。遵循规则只允许在技术上发展到一定程度,然后学生和艺术家必须学习更多,进一步探索。在学习战略艺术的同时,学习其他艺术也是有意义的。

谁没有通过观察别人的活动来更多地了解自己呢?要学剑,就要学吉他。要学商业,先学商业。只学习刀剑会使你心胸狭窄,不能向外成长。

——宫本武藏《五环之书》

一些想法:

The debate between FP and imperative programming (OO, structured, etc), has been raging since Lisp versus Fortran. I think you pose excellent questions but recognize that they are not especially new. Part of the hoopla over FP is that we seem to be recognizing that concurrency is very difficult, and that locks and other mechanisms in OO (e.g. Java) are just one solution. FP offers a refreshing sea change with ideas such as Actors and the power of stateless computing. To those wrestling with OO, the landscape seems highly appealing. Yes, schools teach FP. In fact, the University of Waterloo and others offer Scheme in first year classes (reference here). Regarding the average programmer, I'm sure that the same arguments were given against C++ back in the early 1990s. And look what happened. If businesses can gain an advantage via a technology, you can bet that people will receive training.

这并不是说这是板上钉钉的事,也不是说在3-5年内不会出现反弹(一如既往)。然而,朝着计划生育的趋势是有好处的,值得关注。

我要指出的是,你所说的关于函数式语言的一切,大约20年前,大多数人都在谈论面向对象语言。在那时候,OO是很常见的:

* The average corporate programmer, e.g. most of the people I work with, will not understand it and most work environments will not let you program in it
* It's not really taught at universities (or is it nowadays?)
* Most applications are simple enough to be solved in normal IMPERATIVE ways

改变必须来自某个地方。无论接受过早期技术培训的人是否认为变革没有必要,有意义的重要变革都会发生。尽管当时有很多人反对,但你认为向OO的转变是好的吗?