Re:Programming Paradigms for Dummies: What Every Programmer ...
by jdmichal on Monday November 05, 2018 @05:20PM
(#18386523)
> It's also worth pointing out that C++ really achieved OO (initially) by using macros on top of C.
And this is extremely relevant to the point. If the primary complaint against function programming in Java is "comfort" and "boilerplate"... Macros address both those problems very well. If Java had macros, it would be very simple to isolate and minimize that boilerplate.
Re:Programming Paradigms for Dummies: What Every Programmer ...
by pjmlp on Monday November 05, 2018 @05:42PM
(#18386682)
Java emulates macros via annotations and compiler plugins.
Re:Programming Paradigms for Dummies: What Every Programmer ...
by jdmichal on Monday November 05, 2018 @06:03PM
(#18386808)
Annotation-based methods are crippled by the limitations of annotation placement. For instance, you can't "annotate" an expression, which is where you will tend to see boilerplate of the type needed for partial application. (Because partial application is easiest emulated as a lambda which routes to the target function while providing fixed values to parameters.)
OO languages and functional languages support each other's paradigms (more easily) than a pure imperative language would support either. And both OO and FP languages support declarative styles (like relational or logic languages) better than C would.
EDIT: It's also worth pointing out that C++ really achieved OO (initially) by using macros on top of C. So having a sufficiently expressive meta-language is also important to this. Via such a meta-language, you can achieve many more paradigms in a language than using the language alone.
But many languages lack a meta-language or don't have a standard meta-language which people can rely on.