Comment by cbsmith
10 years ago
> For a human it is much easier to structure such a rewrite as a sequence of very trivial changes. And a "sufficiently smart" compiler must realise that it can be done in less steps.
See, the problem is, for the "sufficiently smart" compiler to easily realize this is possible, the passes need to be purely functional. It turns out, most programmers struggle with understanding functional programming...
Passes need to be simple. Not even functional - just a plain term rewriting.
Although, my approach allows to analyse sufficiently imperative passes too: I've got special cases for "collectors" (lists accumulating ordered data imperatively which theb can be read once), maps (same restriction - all the writes must be done before the first read) and all kinds of destructive assignment to the simple variables.