+19

Why do Object-oriented languages adopt functional programming?

The latest versions of Java already include lambda expressions, C # a long time ago, each version of C # includes more functional features and in its version 7, it includes the functional concept of pattern matching. Ruby, Python or Go ... ------ 🇪🇸 ----- ¿Porqué lenguajes orientados a Objetos adoptan la programación funcional? Las últimas versiones de Java ya incluyen expresiones lambda, C# hace mucho tiempo, cada versión de C# incluye más características funcionales y en su versión 7, incluye el concepto funcional del pattern matching. Ruby, Python o Go…

5/12/2019 4:32:08 PM

Juan Baños

8 Answers

New Answer

+15

InvBoy 😊 Nobody has commented that it is strange or an error, I think it is a success, since it is strengthened with the virtues or advantages of both paradigms, while at the same time compensating the disadvantages of each one of them.

+11

I do not think it is weird or wrong, adds more possibilities to the language, pleasing to those who use them...

+11

Functional languages tend to be more naturally parallelizable. They encourage the use of immutable data structures which reduce the side-effects that make code hard to run on multiple processors. ... Many of the major OOP languages are also adopting functional features.

+7

Perhaps the proponents of some OO languages feel that the language might become redundant if they don't support functional aspects soon.

+5

OO and FP are different paradigms and often you need both. So it's the natural way to support both paradigms in one language.

+2

FP can be a bit hard to understand, so adding OOP creates a nice diversity in the language, free for any programmer to use whats most comfortable. Besides, i dont see a problem with multi-paradigm.

+2

I guess the combination is best because ingrate the best of the both

+2

adding to many practical reasons cited in previous comments, The same way simple variables are not replaced by objects attributes, functions are not replaced by methods.. methods are attached to a class or an object.. Something not practical when your aim is to avoid repetition of some piece of code, or recurcitivity..