home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.arch      Apparently more than just beeps & boops      131,241 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 130,185 of 131,241   
   Anton Ertl to John Levine   
   Re: label variables, was branch splittin   
   07 Nov 25 15:26:38   
   
   From: anton@mips.complang.tuwien.ac.at   
      
   John Levine  writes:   
   >In languages with nested scopes, label gotos   
   >can jump to an outer scope so they have to unwind some frames.  Back when   
   >people used such things, a common use was on an error to jump out to some   
   >recovery code.   
      
   Pascal has that feature.  Concerning error handling, jumping to an   
   error handler in a statically enclosing scope has fallen out of   
   favour, but throwing an exception to the next dynamically enclosing   
   exception handler is supported in a number of languages.   
      
   >Function pointers have a sort of similar problem in that they need to carry   
   >along pointers to all of the enclosing frames the function can see.  That is   
   >reasonably well solved by displays, give or take the infamous Knuth man or boy   
   >program, 13 lines of Algol60 horror that Knuth himself got the results wrong.   
      
   Displays and static link chains are among the techniques that can be   
   used to implement static scoping correctly, i.e., where the man-or-boy   
   test produces the correct result.  Knuth initially got the result   
   wrong, because he only had boy compilers, and the computation is too   
   involved to do it by hand.   
      
   The main horror in the original version is that for some of the Algol   
   60 syntax that is used, it is not obvious without studying the Algol   
   60 report what it means.   
    contains some   
   discussion, and one can find it in various other programming   
   languages, more or (often) less close to the original.  The discussion   
   at  and the   
   difference between the "proper job" version from the "crib the Common   
   Lisp or Scheme solution" version gives some insight.   
      
   The fact that "less close" also produces the correct result suggests   
   that the man-or-boy test is less discerning than Knuth probably   
   intended.  That's a common problem with testing.   
      
   - anton   
   --   
   'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'   
     Mitch Alsup,    
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca