[quote="nionita"][quote="bob"][quote="nionita"][quote="bob"][quote="nionita"]But complex things can be combined from simpler ones (composition). When we will have even better optimizing compilers, this will be the way.[/quote]
Problem is, I am 65 years old now. I won't be programming long enough to see a compiler basically "rewrite" a program like that.[/quote]
The solution may be not so far as you think
When you have a few days for fun, take a look at Haskell and its main compiler GHC. Keywords: deforestation, program transformation.
Interesting enough, one of the optimisation method used there (which is also open to the end user, i.e. programmer) is "rewriting rules".[/quote]
That is a Looonnnnnngggg way away from what was being discussed.[/quote]
If you mean the current performance of Haskell programs: it is still a way but not so long anymore (LLVM backend). But I was talking about expressing complex algorithms by composing simpler parts (functions) - and this is already in the language, NOW.
[quote="bob"]And the "rewriting rules" are pointless, we were talking about the compiler front-end doing this, not the human via rules...[/quote]
No, they are not at all pointless: you can write a library of general combinators (aka EDSL) and use rewriting rules to express general simplification laws. Then the programmer can use those combinators and the resulting program is: a) simpler (and easier to read) and b) optimized by the compiler.[/quote]
Chess programming is all about performance. Simplicity, clarity might be a way to achieve this. Performance is crucial here. Or are we writing quasi mathematical poems. Possible too.