Is there a functional language for C++ ecosystem?

后端 未结 9 1950
孤独总比滥情好
孤独总比滥情好 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: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.

提交回复
热议问题