2 ms·
> as efficiently as possible Which requires a high-level understanding of the program and its control flow.
by chrisseaton 5y ago
> as efficiently as possible
Which requires a high-level understanding of the program and its control flow.
- WalterBright 5y ago> Which requires a high-level understanding of the program and its control flow. The `for` loop construct does not offer the compiler any more understanding of the code than one made from `goto`s. They contain the same information, and are interchangeable. The latter, however, is more amenable to applying mathematical algorithms to. The former is more amenable to human understanding.
- chrisseaton 5y agoWhy is unstructured control-flow better for applying algorithms than structured control flow? That seems counter-intuitive to me. With structured control-flow I can do things like reason about the level of nesting of the loop that I'm in. I can peel a loop iteration by literally saying 'take this loop here - copy the body of it out'. For context here's the kind of structure we use https://chrisseaton.com/truffleruby/basic-graal-graphs/#loops https://chrisseaton.com/truffleruby/basic-graal-graphs/#loop....