Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COThe difference is that `finally` by definition *must* be immediately followed by continuing the transfer that triggered it (an uncaught exception, `return`, etc.). It would be easy to allow "goto-like" transfers within `finally` (which languages do this, by the way?), but doing so would mean that `try { return } finally { ... }` *may not return*, which is completely unexpected. If `finally` calls a function that throws, that's not really the same thing, because we already expect that exceptions may occur at any time and interrupt normal flow.
      singulars
    2. CO@nmclean: Actually, an exception which escapes `finally` is sorta same thing, in that it can result in unexpected and illogical program flow. The only difference is that the language designers, being unable to reject all programs where a finally block could throw an unhandled exception, instead allow such programs to compile and hope the program can accept any consequences that may follow the abandonment of the earlier exception-unwinding sequence.
      singulars
    3. CO@supercat I agree that it breaks expected flow, but my point is that that is *always* the case for unhandled exceptions, whether the current flow is a `finally` or not. By the logic of Kaz's last paragraph, functions should also be free to affect the flow in their caller's scope by way of `continue` etc., because they are allowed to do so by way of exceptions. But this of course is not allowed; exceptions are the *sole* exception to this rule, hence the name "exception" (or "interrupt").
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload