我们在这里讨论 oo 功能混合,但我想知道有多少语言实际上符合这个名称。Scala、Clojure、F#?还有吗?
每个答案获得一种这样的语言会很棒,并稍微解释一下,为什么您认为它是OO功能混合体。
我们在这里讨论 oo 功能混合,但我想知道有多少语言实际上符合这个名称。Scala、Clojure、F#?还有吗?
每个答案获得一种这样的语言会很棒,并稍微解释一下,为什么您认为它是OO功能混合体。
Common Lisp. The functional aspects are quite evident, and, on the other hand, CLOS is the mother of all object models.
Objective Caml - as functional as any language from ML family is, but as the name implies, also has a well-developed (and somewhat unique - the only fully structural one I'm aware of) OO system.
Smalltalk. I'm sure many will disagree, but I think that the language that not only had first-class functions, but used them so heavily that even the most fundamental constructs (such as if/else and loops) were implemented as function calls taking function-type arguments, deserves the label "functional". Besides, you list Ruby, and most of what it has in FP department, it inherited from Smalltalk.
O'Haskell,它基本上是一个带有面向对象功能的 Haskell。
Racket是一种具有类系统的函数式语言(Scheme 的一种方言)。类系统支持可覆盖的方法(如 Java、C#)和可扩展的方法(超类的方法首先获得控制;它决定是否/何时调用子类的方法以及如何处理结果)。类系统还支持高阶合约。
实际上,Lisp 和 Schemes 有很多对象系统。Common Lisp 的 CLOS 可能是最著名和最有影响力的。