Note that there are some explanatory texts on larger screens.

plurals
  1. POObject-oriented programming in a purely functional programming context?
    primarykey
    data
    text
    <p>Are there any advantages to using object-oriented programming (OOP) in a functional programming (FP) context?</p> <p>I have been using <a href="http://en.wikipedia.org/wiki/F_Sharp_%28programming_language%29" rel="noreferrer">F#</a> for some time now, and I noticed that the more my functions are stateless, the less I need to have them as methods of objects. In particular, there are advantages to relying on type inference to have them usable in as wide a number of situations as possible.</p> <p>This does not preclude the need for namespaces of some form, which is orthogonal to being OOP. Nor is the use of data structures discouraged. In fact, real use of FP languages depend heavily on data structures. If you look at the F# stack implemented in <em><a href="http://en.wikibooks.org/wiki/F_Sharp_Programming/Advanced_Data_Structures" rel="noreferrer">F Sharp Programming/Advanced Data Structures</a></em>, you will find that it is not object-oriented.</p> <p>In my mind, OOP is heavily associated with having methods that act on the state of the object mostly to <em>mutate</em> the object. In a pure FP context that is not needed nor desired.</p> <p>A practical reason may be to be able to interact with OOP code, in much the same way F# works with <a href="http://en.wikipedia.org/wiki/.NET_Framework" rel="noreferrer">.NET</a>. Other than that however, are there any reasons? And what is the experience in the Haskell world, where programming is more pure FP?</p> <p>I will appreciate any references to papers or counterfactual real world examples on the issue.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload