3 ms·
Sounds like a page worth another search if you don't mind. I'll give you Internet Points in return! -- my attempt: Imperative defines the order and semantics
by mithametacs 2y ago
Sounds like a page worth another search if you don't mind. I'll give you Internet Points in return!
-- my attempt:
Imperative defines the order and semantics of each step.
Declarative defines the prerequisites and intent of each step.
The algorithms each can implement are equivalent.
- Mikhail_Edoshin 2y agoFound it: https://existentialtype.wordpress.com/2013/07/18/what-if-anything-is-a-declarative-language/ https://existentialtype.wordpress.com/2013/07/18/what-if-any... Semantic is another word that is hard to define.
- mithametacs 2y agoI read that and the followup. It’s good writing but I slightly disagree. Imperative is actually a closer mathematical formalism for some things. I find imperative better for expressing state machines. I find declarative better for backtracking. You can write a state machine with just a loop, an assignable, and conditions. Writing state in prolog is irritating.
- Mikhail_Edoshin 2y agoYou don't even need a loop. Steps, conditions, and a 'goto'. Loop are actually a design mistake. They try to bound 'goto' by making it structured. They are declarative, by the way. As a special case or even as a common case they are fine, but not when they try to completely banish 'goto'. They are strictly secondary. Similarly declarative programming is strictly secondary to imperative. It is a limited form of imperative that codifies some good patterns and turns them into a structure. But it also makes it hard or impossible not to use these patterns.
- Mikhail_Edoshin 2y ago(I would also say that state machine is a foundational model for programming.)