What I get from this is that you tried do transform code that was problematically promise-heavy to a more declarative form and that form didn't solve anything.
Am I missing something?
Because the only takeaway I see is that transforming code to a declarative form isn't magical in that it would solve any deficiency of the underlying code.
I don't see how that supports the notion that declarative code might be too costly.
Coder, writer, nonconformist 🤘
Ex-SWE @ Facebook 🤩
Sharing experience and notes on building a career, sharpening coding skills and creating great things 🏆
Declarative code itself might be not pricey at all - it's clean and nice, no problems.
My example shows that sometimes transformation to declarativity might cost a lot - because it is hard to make a generalized solution. Could I make a config to perform request in any possible variations? Yes, definitely. Is it worth it? Well, that depends on the use cases, your will and budget to make an abstract solution and whatsoever.
Perform a mental experiment: when you use functional and declarative lodash or underscore it costs you nothing on the surface. But somebody spent substantial time separating, coding and debugging primitives you use. It must sound undoubtedly true. And then imagine your project and you, willing to write declarative nice code but lacking needed libraries. Won't writing a one on your own be way to expensive? It might - that's my point.
Either way, there're perfect examples in the comments related to hidden complexity of the computations or too domain-specific solutions like React, for example.
But transforming to any different form might cost a lot. So again, it says nothing about declarativity and only about code transformation.
Transforming code to CPS might cost a lot. Transforming code to SSA might cost a lot. Transforming code to OOP might cost a lot. etc…
But writing declaratively from the start? Well, then the odds that it would cost anything substantial are significantly lower!
I wouldn't start by writing a whole library, I would just write the declarative functions I need. That's actually how functional programmers work… And it's not hard when you are used to it.
Like structured programming, OOP, concatenative programming, logic programming. Like any style, actually.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
What I get from this is that you tried do transform code that was problematically promise-heavy to a more declarative form and that form didn't solve anything.
Am I missing something?
Because the only takeaway I see is that transforming code to a declarative form isn't magical in that it would solve any deficiency of the underlying code.
I don't see how that supports the notion that declarative code might be too costly.
Declarative code itself might be not pricey at all - it's clean and nice, no problems.
My example shows that sometimes transformation to declarativity might cost a lot - because it is hard to make a generalized solution. Could I make a config to perform request in any possible variations? Yes, definitely. Is it worth it? Well, that depends on the use cases, your will and budget to make an abstract solution and whatsoever.
Perform a mental experiment: when you use functional and declarative
lodash
orunderscore
it costs you nothing on the surface. But somebody spent substantial time separating, coding and debugging primitives you use. It must sound undoubtedly true. And then imagine your project and you, willing to write declarative nice code but lacking needed libraries. Won't writing a one on your own be way to expensive? It might - that's my point.Either way, there're perfect examples in the comments related to hidden complexity of the computations or too domain-specific solutions like React, for example.
But transforming to any different form might cost a lot. So again, it says nothing about declarativity and only about code transformation.
Transforming code to CPS might cost a lot. Transforming code to SSA might cost a lot. Transforming code to OOP might cost a lot. etc…
But writing declaratively from the start? Well, then the odds that it would cost anything substantial are significantly lower!
I wouldn't start by writing a whole library, I would just write the declarative functions I need. That's actually how functional programmers work… And it's not hard when you are used to it.
Like structured programming, OOP, concatenative programming, logic programming. Like any style, actually.