3 ms·
I agree with you. Readability is definitely worse when using this method. It doesn't mean it can't be circumvented with good naming. Overall though this method
by Geminidog 6y ago
I agree with you. Readability is definitely worse when using this method. It doesn't mean it can't be circumvented with good naming.
Overall though this method basically solves the problem with technical debt I described above.
The root of all dependencies come from free variables. So if you get rid of free variables and turn your functions into combinators, then all your logic is modular.
If you get rid of all variables then all your code has to be combinators.
Perhaps the point free style goes to far in terms of readability. Maybe just switching to combinators is a good middle ground. In layman's terms for the readers who don't understand this means don't even use pure functions in classes. Just use functions.
- unityByFreedom 6y ago> this means don't even use pure functions in classes. Just use functions. ... so you agree with the author of this post? Also, seems like there is tech debt with point free, you just have it up front rather than putting it off until later.
- Geminidog 6y agoDepends on the definition of tech debt. Do you mean structural/organizational or readability? If you mean readability then yes, the point free style does not protect you from that imo. But combinators and the point free style does protect you from structural and organizational issues, which is the type of technical debt I'm referring too.
- unityByFreedom 6y agoI meant up front you'd need to write more functions than you would when using functions that allow multiple arguments.
- Geminidog 6y agoLook up something called currying. It solves the issue. You can still write functions with multiple arguments and then "curry" them into functions of just one argument. Of course this does not solve the readability issue.
- shakow 6y agoThe problem with currying is that I don't know of a nice syntax to curry on a random access argument rather than on the first one.
- Geminidog 6y agoIt exists with dummy variables. Ive seen it with C++ bind and many fp libraries in JavaScript as well.
- shakow 6y agoBut then it's not pointfree, it's just anaonymous variables instead of named.
- Geminidog 6y agoYeah technically it's not point free. But technically nothing can truly be point free just like nothing can ever be truly purely functional. In purely functional programming your IO and state has to live somewhere just like how your points in point free programming still have to exist on the function call. A function that takes multiple arguments introduces extra points to your program similar to introducing extra IO calls to your purely functional program. These points are inevitable additions to your program. The philosophy remains point free however. Another way to think about it is that every parameter in a point free program is tied to a point somewhere up the pipeline. If you introduce a function with multiple arguments, that extra argument will still need to be tied to a point either right now or up some other pipeline. So either you curry in a point into that extra parameter or you curry in the result of another pipeline. A good way to think of the point free style is a series of pipes flowing in one direction, from left to right. All pipes segments must be eventually connected to a source and eventually flow to an output. A function with 2 parameters is a T junction within this system with 2 inflows and one outflow. No matter how you configure your network of pipes; points need to live to the at the source and output of this network either as IO or actual state. There is no "point" in creating a network of pipes that isn't connected to a source and an output. When you introduce a new T junction into this network of pipes, you will inevitably need to connect these inflows to points at the source of the pipe network. There's no way around it.