ExitFunction

From Erights

(Difference between revisions)
Jump to: navigation, search
(more categories)
 
Line 23: Line 23:
[[Category:Reference properties]]
[[Category:Reference properties]]
[[Category:Unresolved design issues]]
[[Category:Unresolved design issues]]
 +
[[Category:Protocols]]
 +
[[Category:Message run/1]]

Latest revision as of 02:27, 2 July 2008

Currently hypothetical as a guard and auditor. Ejectors and throw are existing examples of ExitFunctions.

An ExitFunction is an object whose run/1 method does not return, and has no side effects before it exits. That is, calling an ExitFunction's run/1 cannot be plan interference.

In the below example, it is guaranteed that println("okay") will happen before any effects specific to ef occur, and that println("oops") will not happen.

def example(ef :ExitFunction) {
    try {
        ef("boo")
    } finally {
        println("okay")
    }
    println("oops")
}

Proposal

User:Kevin Reid proposes that parameters which are expected to be ejectors should be guarded by ExitFunction instead of OneArgFunc, except where the programmer has considered the possibility of plan interference.

See also Non-optional ejectors.

Personal tools
more tools