Live data from Hacker News

Why does nobody seem to know what imperative and declarative mean?

leebriggs.co.uk

1–10 of 77 posts

Re: Why does nobody seem to know what imperative and declarative mean?

#7
Yes, Pulumi is nouns not verbs. It is declarative. Like Terraform, you're not saying: "make me an virtual machine," you're saying, "this virtual machine", which gets created if needed.

But like Terraform can be if you start importing data-sources, Pulumi can get dynamic. Your Pulumi code might have some actions/verbs it does to figure out what to write. You might slip up one day and get a little bit pregnant. Oops I mean get a little bit imperative. In Terraform, these external dependencies are declared, are declarative style, but they carry the risk of imperativeness, in that they don't have idempotency, they don't clearly delineate what is expected: they're commands-as-structures, actions-as-structures, executed via higher level systems.

Pulumi might not be imperative, but there's less clear lines (unlike an explicit Terraform data-source) & it's less clear when you get a little bit imperative.

Re: Why does nobody seem to know what imperative and declarative mean?

#8
post #5

Amazing rant but I really wish they gave you a quick tldr on what the fuck the difference is between imperitive and declarative.

Flow control? Imperative.

No flow control? Declarative.

What is flow control? Typically if/then/else statements.

Importantly, setting a variable with a conditional does not make the language necessarily imperative.

I wonder if a language can be Turing-complete without flow control. My guess is no?

Post reply on HN