4 ms·
The post talks about “intent” which is pretty vague. A more common definition is that imperative code specify a sequence of steps to execute while declarative
by bazoom42 3y ago
The post talks about “intent” which is pretty vague.
A more common definition is that imperative code specify a sequence of steps to execute while declarative code specify the desired end state, and the engine have to figure out how to arrive there.
By this definition Excel is declarative because you don’t specify in which order to execute the operations. Excel has to figure out when and in which order to execute the formula, presumably by building a dependency graph.
- LikesPwsh 3y agoYou could make that same argument for any parallelism - your CPU queues some inputs and processes them in an arbitrary order after considering dependencies. There's a long way between hand-writing CPU instructions to make sure it does the same thing between runs, and the other extreme of writing a terraform yaml config and letting the engine decide how to get there. Excel is so far from SQL/YAML that I can't lump them all together as "declarative". "Column from examples" comes to mind as a more declarative Excel feature than formulas in general.
- naasking 3y ago> You could make that same argument for any parallelism - your CPU queues some inputs and processes them in an arbitrary order after considering dependencies. No, the CPU instructions are explicitly sequenced. The fact that the CPU can sometimes execute them out of order doesn't change this basic fact. Excel is absolutely declarative in its core form. Of course the scripting languages that are embedded can change that, but it's 100% declarative if you don't use that part of it. A = B + C in Excel is not a calculation or assignment operation, it's declaring a relation between those variables that Excel preserves how it sees fit.