3 ms·
>I'm partial of the explanation of DP as missing language features. It is a way to encode basic features in terms of simple standard building blocks: objects.
by ernst_klim 9y ago
>I'm partial of the explanation of DP as missing language features.
It is a way to encode basic features in terms of simple standard building blocks: objects. However, I think that explaining everything in terms of objects is a terrible idea. Objects are extremely complex already, it is a bad idea to use them as a basic entity. Just compare lambda semantic rules (there are only three of them for untyped lambda calculus), and an object's semantic. Later is much more complex.
I think that the complexity of objects led to the complexity of patterns, making them verbose and ugly. Just compare visitor and pattern matching, or command and higher order function.
It is true that in more advanced languages having more features patterns become invisible, but I thing they also would become invisible if they were composed of more simple entities.
- mikekchar 9y agoAn object is literally an encapsulation of state. Imagine having 3 functions which do something with points on a graphical plane. The first 2 parameters in each function represent the x and y positions of the point. You can make an OO "class" by simply grouping those three functions. You can make an object by partially applying x and y to the three functions. You can "respond to messages" by calling those functions. I agree with you that many OO languages add unnecessary syntax and lack features, but objects are not related. We need to encapsulate state and we like to group functions into cohesive modules that are related to the state that they are going to deal with. We do this whether we use object nomenclature or not.