
On Fri, Apr 9, 2021 at 10:58 AM David Mason via talk <talk@gtalug.org> wrote:
On Apr 9, 2021, 1:45 PM -0400, Stewart C. Russell via talk <talk@gtalug.org>, wrote:
After all with a loop you are controlling the execution order of the processing. If done right you usually shouldn't need to care.
But in document processing, you really really /really/ want the output to come out in the same order as the input. Which is why functional languages seemed a strange choice for document transformation. The absence of side-effects can be handy in document processing, but being in the right order is usually what publishing houses get paid the big bucks to do.
The key part of what Lennart wrote is “if done right”. How could you imagine that the functional program would return the results out of order? Compilers/interpreters are allow to make whatever optimizations they want, as long as time and memory consumption are the only things that change from the original!
I probably misread your statement. Compilers also routinely reorder memory accesses as well, as long as the end result will not change. Sometimes the cause for some fun to debug issues (in C/C++).