• Robert Griesemer's avatar
    spec: clarify returns, defer statements, and panics · 1e8e14c9
    Robert Griesemer authored
    This is an attempt at making the interaction between
    these three constructs clearer. Specifically:
    
    - return statements terminate a function, execute deferred
      functions, return to the caller, and then execution
      continues after the call
    
    - panic calls terminate a function, execute deferred
      functions, return to the caller, and then re-panic
    
    - deferred functions are executed before a function _returns_
      to its caller
    
    The hope is that with this change it becomes clear when a
    deferred function is executed (when a function returns),
    and when it is not (when a program exits).
    
    R=r, rsc, iant, ken, iant
    CC=golang-dev
    https://golang.org/cl/6736071
    1e8e14c9
go_spec.html 168 KB