News for hackers. Stuff that matters.
Re:Generate code for declarative language instead of program... by bazoom42 on Tuesday April 23, 2024 @01:41AM (#40128865)
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.

Re:Generate code for declarative language instead of program... by LikesPwsh on Tuesday April 23, 2024 @07:35AM (#40130699)
You 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.

Re:Generate code for declarative language instead of program... by naasking on Tuesday April 23, 2024 @09:09AM (#40131547)
> 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.