Comment by embedding-shape
6 hours ago
> All these started with pure declarative DSL then incrementally created a nightmarish imperative monstrosity.
"Huh?" I asked myself when you mentioned that Terraform is now imperative somehow. Took a look at the website again, and seems to still be HCL, and still be declarative. Am I missing something? How exactly is Terraform today a "imperative monstrosity"?
Terraform has modules which are an elaborate method of doing function calls. HCL 2 has loops and conditionals. It is most definitely imperative.
This is not necessarily a problem except that they had to live in the original HCL v1 landscape which makes them awkward syntactically.
> Terraform has modules which are an elaborate method of doing function calls
... What? How is modules a function call? It's just a hierarchy, everything about/with modules is still declarative.
> HCL 2 has loops and conditionals. It is most definitely imperative.
So what? Just because there is loops and conditionals doesn't mean it's suddenly imperative.
How exactly you do loops in HCL? Last time I used it, you still used declarative configuration for that, and use `for_each` as an declared option, you don't "call for_each which returns config", all that happens inside of HCL/TF, because it is declarative.
Did something change like yesterday or are people even here on HN so ignorant about what declarative vs imperative actually means?
You "call" a module with arguments. You can call them multiple times. In every way that matters they are just like a function call.
I don't understand why there is a distinction between for each in a standard language vs for_each in HCL2. They are both do something by iterating over something else at runtime. The syntax isn't what matters here.
I think maybe you are mistaken in your own distinction between declarative and imperative.
2 replies →