Leonard/Janis Robert König on Nostr: It's much harder to reason whether those store bought peeled tomatoes would work for ...
It's much harder to reason whether those store bought peeled tomatoes would work for the imperative recipe because a) it conflicts with the instructions and b) maybe they were peeled differently. The declarative version makes it implicit that actually *we do not care* about *how* they were peeled. If someone at some points invents genetically modified tomatoes that grow pre-peeled, they'd be fine as well.
The imperative approach restricts the solution of the problem to precisely what was implemented. If we would want to prepare some steps simultaneously, we'd need to do that explicitly. With declarative code, the parallelization is simply an implicit possibility.
A prime example is make(1) and Makefiles: You state what dependencies need to be satisfied for any rule and `make` figures out what can be done in parallel. Just pass `-j N` with `N` being the number of parallel jobs.
Of course, you need to be careful anytime declarative code is interacting with the imperative world. So with make: The commands executed are stateful and may not always be able to run in parallel.
Similarly, the interpreter/runtime must have its own scheduling logic: Preparing food from the declarative description above requires much more thought on the cook's side than the recipe.
The imperative approach restricts the solution of the problem to precisely what was implemented. If we would want to prepare some steps simultaneously, we'd need to do that explicitly. With declarative code, the parallelization is simply an implicit possibility.
A prime example is make(1) and Makefiles: You state what dependencies need to be satisfied for any rule and `make` figures out what can be done in parallel. Just pass `-j N` with `N` being the number of parallel jobs.
Of course, you need to be careful anytime declarative code is interacting with the imperative world. So with make: The commands executed are stateful and may not always be able to run in parallel.
Similarly, the interpreter/runtime must have its own scheduling logic: Preparing food from the declarative description above requires much more thought on the cook's side than the recipe.