4 ms·
As much as I'd love to imbue his grandmother (and by extension all grandmothers) with innate understanding of some programming principle that some seem to have
by giberson 15y ago
As much as I'd love to imbue his grandmother (and by extension all grandmothers) with innate understanding of some programming principle that some seem to have trouble with I'm afraid this event or at least the authors recounting of this event does not lead to that conclusion.
The grandmother may not have been having trouble with the immutability of X. Her question was not "how can X be anything other than X?" It was "How can X be X+1?". Which could convey the more likely case of the unlearned coder not understanding the order of operation in program flow. I'm sure she understood that X could be assigned a value, I'm sure she even understood that X could be changed--what she was having trouble with, most likely, was how could you use X on the right hand side of the equator? How can you define a value with the value itself (Circular reference). And I can totally relate--when I first learned programming it was something that confused myself at first as well. I hadn't learned that the right hand side of the equator gets evaluated with X being resolved to it's "present" value which is then used to calculate the value and finally stored back in the variable.
I hate to be a downer, it certainly is a fond memory, but the initial supposition is inconclusive.