Mark S. Miller (2013-08-31T22:48:56.000Z)
domenic at domenicdenicola.com (2013-09-08T00:57:04.605Z)
On Sat, Aug 31, 2013 at 2:12 PM, Yuichi Nishiwaki <yuichi.nishiwaki at gmail.com> wrote: > I get the point. Indeed. Modes are a kind of magic... > > Regarding the secondary reason: > I don't understand the "difference" well, could you explain in detail? ```js function f(....) { // .... code sequence 1 // .... balanced code sequence 2 // .... code sequence 3 } ``` Without looking at f's parameters, code sequence 1, or code sequence 3, the reader knows that code sequence 2 will execute some number of times, perhaps 0, only during the turn in which f is called and before f returns. Once f's caller gets control again, code sequence 2 will no longer ever execute as part of that call to f. The only contextual knowledge the reader needs in order to know this is that there are no intermediate function definitions within f wrapping code sequence 2 -- i.e., that code sequence 2 is code of the function f itself, as opposed to code of a function within function a. It suffices to check that there are no unbalanced function definition starts in code sequence 1. Beyond this "is it wrapped in a function" question, the reader doesn't even care if code sequence 1 starts a control structure wrapping code sequence 2, that is closed in code sequence 3. If the header says `function*`, then the reader knows that they do not know all this, and a more careful read is needed to understand when code sequence 2 might execute as part of a given call to f after f's caller resumes. See http://erights.org/data/irrelevance.html on the need to do partial reasoning about code fragments. I find it frustrating that there so little computer science devoted to the cognitive load required of such partial program understanding tasks. This properly should be part of the study of "notation as user interface".