2 ms·
The idea of a class encapsulating functionality and traits is definitely at odds with PFP. PFP would prefer free functions, after all. However, a Data Class wi
by Alupis 4y ago
The idea of a class encapsulating functionality and traits is definitely at odds with PFP. PFP would prefer free functions, after all.
However, a Data Class without mutability and without functionality (besides accessors) is in-line with PFP.
Like I said, most modern systems are hybrids - taking the best of all paradigms instead of aligning with a singular paradigm as was done in the past.
- valenterry 4y agoNot really, at least not in my terminology. Classes (in the pfp world) are pretty much just a bundle of free functions with some predefined bindings that are available to all those free functions, and putting those functions into their own namespace. Those are valid things to do even in pfp. data classes are technically similar or even identical but conceptually a different thing (though of course also useful and needed).