diff --git a/pages/fundamentals/acknowledgements.html b/pages/fundamentals/acknowledgements.html index dfcc0ac6..2ec16438 100644 --- a/pages/fundamentals/acknowledgements.html +++ b/pages/fundamentals/acknowledgements.html @@ -218,6 +218,7 @@

Acknowledgments

Rahul, zlqpzww, iridescentGray, +balagrivine, etc.

diff --git a/pages/fundamentals/control-flows-more.html b/pages/fundamentals/control-flows-more.html index 6d92f961..3879efc4 100644 --- a/pages/fundamentals/control-flows-more.html +++ b/pages/fundamentals/control-flows-more.html @@ -405,15 +405,14 @@

Deferred Function Calls

When a defer statement is executed, the deferred function call is not executed immediately. -Instead, it is pushed into a deferred call queue maintained by its caller goroutine. +Instead, it is pushed into a defer-call stack maintained by its caller goroutine. After a function call fc(...) returns (but has not fully exited yet) and enters its exiting phase, -all the deferred function calls pushed into the deferred call queue -during executing the function call will be removed from the deferred call queue and executed, +all the deferred function calls pushed into the defer-call stack +during executing the function call will be removed from the defer-call stack and executed, in first-in, last-out order, that is, the reverse of the order -in which they were pushed into the deferred call queue. -Once all these deferred calls are executed, -the function call fc(...) fully exits. +in which they were pushed into the defer-call stack. +Once all these deferred calls are executed, the function call fc(...) fully exits.

Here is a simple example to show how to use deferred function calls. @@ -503,7 +502,7 @@

The Evaluation Moment of the Arguments of Deferred Function Calls

The arguments of a deferred function call are all evaluated at the moment when the corresponding defer statement is executed -(a.k.a. when the deferred call is pushed into the deferred call queue). +(a.k.a. when the deferred call is pushed into the defer-call stack). The evaluation results are used when the deferred call is executed later during the existing phase of the surrounding call (the caller of the deferred call).

diff --git a/pages/fundamentals/defer-more.html b/pages/fundamentals/defer-more.html index 092379e1..bda6d3a4 100644 --- a/pages/fundamentals/defer-more.html +++ b/pages/fundamentals/defer-more.html @@ -48,7 +48,7 @@

The Evaluation Moment of Deferred Function Values

The called function (value) in a deferred function call is evaluated -when the call is pushed into the deferred call queue of the current goroutine. +when the call is pushed into the defer-call stack of the current goroutine. For example, the following program will print false.
package main
@@ -70,7 +70,7 @@ 

The Evaluation Moment of Deferred Function Values

The called function in a deferred function call may be a nil function value. For such a case, the panic will occur when the call to the nil function is invoked, -instead of when the call is pushed into the deferred call queue of the current goroutine. +instead of when the call is pushed into the defer-call stack of the current goroutine. An example:
package main
 
@@ -97,7 +97,7 @@ 

The Evaluation Moment of Receiver Arguments of Deferred Method Calls

As explained before, the arguments of a deferred function call are also evaluated when -the deferred call is pushed into the deferred call queue +the deferred call is pushed into the defer-call stack of the current goroutine.

@@ -117,7 +117,7 @@

The Evaluation Moment of Receiver Arguments of Deferred Method Calls

var t T // "t.M(1)" is the receiver argument of the method // call ".M(2)", so it is evaluated when the - // ".M(2)" call is pushed into deferred call queue. + // ".M(2)" call is pushed into defer-call stack. defer t.M(1).M(2) t.M(3).M(4) } @@ -286,7 +286,7 @@

Kind-of Resource Leaking by Deferring Function Calls

-A very large deferred call queue may also consume much memory, +A very large defer-call stack may also consume much memory, and some resources might not get released in time if some calls are delayed too much. For example, if there are many files needed to be handled in a call to the following function, diff --git a/pages/fundamentals/panic-and-recover-more-newer.html b/pages/fundamentals/panic-and-recover-more-newer.html index ad0ec18b..00628152 100644 --- a/pages/fundamentals/panic-and-recover-more-newer.html +++ b/pages/fundamentals/panic-and-recover-more-newer.html @@ -15,7 +15,7 @@

Exiting Phases of Function Calls

In Go, a function call may undergo an exiting phase before it fully exits. -In the exiting phase, the deferred function calls pushed into the deferred call queue +In the exiting phase, the deferred function calls pushed into the defer-call stack during executing the function call will be executed (in the inverse pushing order). When all of the deferred calls fully exit, the exiting phase ends and the function call also fully exits. @@ -171,7 +171,7 @@

Associating Panics of Function Calls

if there was an old unrecovered panic associating with the nesting call before, the old one will be replaced by the spread one. For this case, the nesting call must had already entered its exiting phase for sure, - so the next deferred function call in its deferred call queue will be invoked. + so the next deferred function call in its defer-call stack will be invoked.
  • if there was not an unrecovered panic associating with the nesting call before, diff --git a/pages/fundamentals/panic-and-recover-more-old.html b/pages/fundamentals/panic-and-recover-more-old.html index e8743b81..e60fc601 100644 --- a/pages/fundamentals/panic-and-recover-more-old.html +++ b/pages/fundamentals/panic-and-recover-more-old.html @@ -25,7 +25,7 @@

    Exiting Phases of Function Calls

    In Go, a function call may undergo an exiting phase before it fully exits. -In the exiting phase, the deferred function calls pushed into the deferred call queue +In the exiting phase, the deferred function calls pushed into the defer-call stack during executing the function call will be executed (in the inverse pushing order). When all of the deferred calls fully exit, the exiting phase ends and the function call also fully exits. @@ -177,7 +177,7 @@

    Associating Panics and Goexit Signals of Function Calls

    if there was an old unrecovered panic associating with the nesting call before, the old one will be replaced by the spread one. For this case, the nesting call has already entered its exiting phase for sure, - so the next deferred function call in the deferred call queue will be invoked. + so the next deferred function call in the defer-call stack will be invoked.
  • if there was not an unrecovered panic associating with the nesting call before, diff --git a/pages/fundamentals/panic-and-recover-more.html b/pages/fundamentals/panic-and-recover-more.html index 8246a328..98d95315 100644 --- a/pages/fundamentals/panic-and-recover-more.html +++ b/pages/fundamentals/panic-and-recover-more.html @@ -15,7 +15,7 @@

    Exiting Phases of Function Calls

    In Go, a function call may undergo an exiting phase before it fully exits. -In the exiting phase, the deferred function calls pushed into the deferred call queue +In the exiting phase, the deferred function calls pushed into the defer-call stack during executing the function call will be executed (in the inverse pushing order). When all of the deferred calls fully exit, the exiting phase ends and the function call also fully exits. @@ -162,7 +162,7 @@

    Associating Panics and Goexit Signals of Function Calls

    if there was an old unrecovered panic associating with the nesting call before, the old one will be replaced by the spread one. For this case, the nesting call must had already entered its exiting phase for sure, - so the next deferred function call in its deferred call queue will be invoked. + so the next deferred function call in its defer-call stack will be invoked.
  • if there was not an unrecovered panic associating with the nesting call before,