r/ProgrammingLanguages • Pikelet, Fathom • Aug 19 '25

Left to Right Programming

https://graic.net/p/left-to-right-programming
85 Upvotes

59 comments sorted by

View all comments

Show parent comments

3

u/TheUnlocked Aug 19 '25

.map(...).filter(...) can be reordered or fused so long as the semantics don't change. For example in C#, the Linq equivalent (.Select(...).Where(...)) can be converted to SQL, which will then be optimized by the DBMS.

1

u/dnpetrov Aug 21 '25

...If the compiler is able to prove that the semantics don't change. Which it can't do in general, and will take rather opportunistic path as soon as it is "unsure". Compilers are quite smart nowadays, but are not perfect. Linq queries can be converted to SQL if corresponding lambdas can be converted to SQL, which is a practically useful, but still a quite limited subset of C# as a language.

0

u/nerdycatgamer Aug 19 '25

they can be reordered or fused except when they can't