Mixing object-oriented and functional programming

前端 未结 12 1870
渐次进展
渐次进展 2020-12-24 01:33

What languages are available that promote both object-oriented and functional programming? I know that any language that supports first-class functions can be considered fun

12条回答
  •  孤独总比滥情好
    2020-12-24 02:07

    Haskell: Pure functional ,pretty much no OO, but go ahead, take the dive. :D

    Scala: Beautiful mix of OO and FP, could possibly overtake java as premier language on the JVM in a decade or 2. I like it because it brings functional programming to the java platform, something that's sorely need IMHO.

    C#: Awesome support for OO, as well as getting more functional (first class functions already, we'll see what improvements .net 4 brings)

    F#: .net language Built to be functional specifically, as opposed to C#, which was originally conceived for OO stuff.

    Python: Great for OO, but not at all suited to FP

    Javascript: Supports first-class functions, but not specifically designed for FP like Scala and F#. Still slightly better than python IMHO.

    Why do you want to mix OO and FP? As a stepping stone?

提交回复
热议问题