功能语言的独特特征 [英] Distinctive traits of the functional languages
问题描述
其他功能语言(Clojure,F#,Arc,any other)之间有什么独特的基本区别?根据本质,我的意思是影响你在这种语言中发展的方式,例如,不是,不管它是否与一些广泛的运行时集成。
离开我的头顶:
- 懒惰与 eager (aka non-strict vs. 严格或 call-by-need vs. call-by-value ):是函数应用程序前评估的函数参数,以后,还是永远不会?
- em> vs. impure :语言是否允许功能有副作用?是否有可变引用?
- static 与动态 :编译时或运行时的语言检查类型是否正确?
- 代数数据类型 :语言支持模式是否匹配变体类型?
- metaprogramming :该语言是否提供强大的代码生成系统?
- 并发 和 parallelism :是线程/进程的一级抽象?该语言是否同时运行多个计算容易?
- 异国情调类型:静态类型系统的表现力如何? GADTs?依赖类型?线性类型系统F?
只有前两个项目对于功能语言才是真正独一无二的(即几乎所有的命令式语言都是渴望和不纯的)。
It is known that all functional languages share some basic properties like using functions as basic building block for programs with all the consequences like using recursion instead of iteration. However, some fundamental differences also exist. Lisp uses a single representation for both Lisp code and data, while ML has no standard representation of ML code. Erlang has a built-in actor-based concurrency. Haskell has monads. Haskell makes a distinction in the static type system between pure and impure functions; ML does not.
What are the distinctive fundamental differences between other functional languages (Clojure, F#, Arc, any other)? By fundamental I mean something which influences the way you develop in this language, and not for example, whether it is integrated with some wide-spread runtime.
Off the top of my head:
- lazy vs. eager (aka non-strict vs. strict or call-by-need vs. call-by-value): are function arguments evaluated before the function application, or after, or never?
- pure vs. impure: does the language allow functions to have side effects? Does it have mutable references?
- static vs. dynamic: does the language check types at compile time or runtime?
- algebraic datatypes: does the language support pattern matching over variant types?
- metaprogramming: does the language provide a powerful code generation system?
- concurrency and parallelism: are threads/processes a first-class abstraction? Does the language make it easy to run multiple computations at the same time?
- "exotic" types: how expressive is the static type system? GADTs? Dependent types? Linear types? System F?
Only the first two items are really unique to functional languages (i.e., almost all imperative languages are eager and impure).
这篇关于功能语言的独特特征的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!