2 ms·
Sometimes things just don't have a good name. Focusing on a few well-named temporary variables that corresponds to logical steps usually yield clearer code than
by Zababa 5y ago
Sometimes things just don't have a good name. Focusing on a few well-named temporary variables that corresponds to logical steps usually yield clearer code than trying to name everything.
- ravenstine 5y agoThere's truth to that, but I also find that if I can't name something chances are that what I'm writing isn't as sensibly structured as it could be. I would rather solve these problems by creating new scopes than to effectively strip away names in favor of a chain of generic function calls.
- Zababa 5y agoThat's true, in these cases I usually write a function that's basically a composition of functions. The power of the pipeline operator is ad-hoc function composition. This is useful if you have lots of very generic functions, and don't want to name every single composition. There is already the f(g(h(x))) syntax, of course, but it's not the most readable. I do agree in general that this operator isn't really needed. Probably not worse than Python's := or structural pattern matching, it's one of those things where either you base the language on it, or you don't and adding it is not really necessary.