Is reading and understanding code the same as executing the code?
Yes
4.8%
No
95.2%
Poll ended at .

@RosaCtrl yes, under an asterisk: literally anything a program does can be understood by abstract interpretation with a suitable abstraction of program values (“suitable” is load-bearing here), and to a given level of approximation. On one end of the spectrum, the concrete interpretation of the program is a degenerate instantiation of abstract interpretation. On the other end, you can absolutely pose undecidable questions like “will the program halt?” for example, but the answer will sometimes be “maybe.”

Furthermore, abstract interpretation is mechanizable (cf David Darais’ thesis, Mechanizing Abstract Interpretation), so we can compute these analyses.

So: “executing” is necessarily a complete lens on program behaviour, given the above abstraction of what it means to compute. We do this in our heads when we read and understand a program for example to debug it.

We also synthesize a higher-level understanding, connecting the program to concepts not immediate, or sometimes not even apparent in the syntax. Since this is (IMO) “just” another kind of semantics, it’s subject to the above as well.

But understanding what a program does is not the only way of understanding a program. Why was it written? Why was it written this way, or in this language? What was the intent, what are the social factors that shaped it, how has it evolved? Because of course source code is a program, but the whole light cone that led into its state at a given point in time is potentially relevant to understanding it through these lenses.

At the end of the day I think we care more, moment to moment, about understanding program behaviour than programmer intent, and probably that’s appropriate; the Purpose Of a System Is What It Does (POSIWID) is an extremely valuable model. But we also ask ourselves questions about what a program was, and what it could be, and some of those are less about program behaviour than about expression or form, and there are many equivalent phrasings of a program, in terms of its observable properties, that are nevertheless possess extremely different properties for the reader. Consider linters, formatters, minifiers, obfuscators, alpha renaming, refactoring, etc.

So I said yes because I wanted to share about fifty-two years of abstract interpretation (thank you Cousot and Cousot!), but also no. A waffle, but, I think, a principled one.

@robrix regarding abstract interpretation being mechanisable I would add that mechanisation is always better. After posting the poll I started to think on how well I could trace the behaviour of simple algorithms with pen and paper, but give me something with concurrency and I’ll keep making mistakes all over the place