Is there a functional language for C++ ecosystem?

后端 未结 9 1939
孤独总比滥情好
孤独总比滥情好 2021-02-05 19:34

Java has Scala and .NET has F#. Both of these languages are very highly integrated into the respective Java and .NET platforms. Classes can be written in Scala then extended i

相关标签:
9条回答
  • 2021-02-05 20:07

    As has been said, I'm not really sure about a C++ 'ecosystem'. But Haskell does have a Foreign Function Interface that allows you to call C functions from Haskell and Haskell functions from C.

    Then again, that's C, I'm not really sure how far along the C++ FFI is...

    0 讨论(0)
  • 2021-02-05 20:11

    This question was posted in 2008. For reference, C++11 onwards have support for functional programming. See another discussion updated for this Functional Programming in C++

    0 讨论(0)
  • 2021-02-05 20:13

    C++ doesn't have an ecosystem in the sense of Java or .NET. There's no virtual machine, no runtime environment even, there's only a highly specialized standard library that by design doesn't operate well in a purely functional environment. C++ doesn't even have an ABI standard.

    All things considered, I'm not sure what you mean/expect.

    0 讨论(0)
  • 2021-02-05 20:19

    The 'D' language was designed as a successor to C++. A purely functional subset of D is being developed by Andrei Alexandrescu for D 2.0. I am guessing D interoperates well with C++.

    0 讨论(0)
  • 2021-02-05 20:19

    C++ may not be a pure functional language, but parts of STL are certainly functional.

    See Bjarne Stroustrup FAQ (the inventor of the c++)

    0 讨论(0)
  • 2021-02-05 20:20

    The Felix language by John Skaller is designed to interoperate with C++ and provide the functional paradigm.

    There are problems with doing this though. Functional languages provide first-class functions which allow the creation of closures: functions that have captured and carry values from the environment they were defined in. This makes it impossible to determine the lifetimes of values statically (because a closure might carry a value out of its scope) and, consequently, effectively requires a garbage collector but C++ is not garbage collected.

    0 讨论(0)
提交回复
热议问题