Mixing object-oriented and functional programming

前端 未结 12 1895
渐次进展
渐次进展 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:19

    The best known are OCaml and F# (which can be vaguely described as OCaml for .NET).

    There are many other multi-paradigm languages, like Oz, but they have mostly pedagogical value. By contrast, OCaml is very practical. It's almost as fast as C and almost as beautiful as Haskell :)

    The popular scripting languages like Python and Ruby let you program in functional style as well. However, they don't provide one of the strongest facilities that "classical" functional languages (as well as OCaml) have: pattern matching (don't mistake it for regexp).

提交回复
热议问题