--- layout: default title: "Failing" parent: Abnormal ancestor: Funcons-beta --- [Funcons-beta] : [Failing.cbs] ----------------------------- ### Failing
[
Datatype failing
Funcon failed
Funcon finalise-failing
Funcon fail
Funcon else
Funcon else-choice
Funcon checked
Funcon check-true
]Meta-variables
T <: valuesDatatype
failing ::= failedfailed is a reason for abrupt termination.
Funcon
finalise-failing(X:=>T) : =>T|null-type
~> finalise-abrupting(X)finalise-failing(X) handles abrupt termination of X due to executing fail.
Funcon
fail : =>empty-type
~> abrupt(failed)fail abruptly terminates all enclosing computations until it is handled.
Funcon
else(_:=>T, _:(=>T)+) : =>Telse(X1, X2, ...) executes the arguments in turn until either some
Xi does *not* fail, or all arguments Xi have been executed.
The last argument executed determines the result.
else(X, Y) is associative, with unit fail.
Rule
X --abrupted( )-> X′
--------------------------------------
else(X, Y) --abrupted( )-> else(X′, Y)
Rule
X --abrupted(failed)-> _
---------------------------------
else(X, Y) --abrupted( )-> Y
Rule
X --abrupted(V:~failing)-> X′
--------------------------------------
else(X, Y) --abrupted(V)-> else(X′, Y)
Rule
else(V:T, Y) ~> V
Rule
else(X, Y, Z+) ~> else(X, else(Y, Z+))Funcon
else-choice(_:(=>T)+) : =>Telse-choice(X,...) executes the arguments in any order until either some
Xi does *not* fail, or all arguments Xi have been executed.
The last argument executed determines the result.
else(X, Y) is associative and commutative, with unit fail.
Rule
else-choice(W*, X, Y, Z*)
~> choice(else(X, else-choice(W*, Y, Z*),
else(Y, else-choice(W*, X, Z*))))
Rule
else-choice(X) ~> XFuncon
check-true(_:booleans) : =>null-type
Alias
check = check-truecheck-true(X) terminates normally if the value computed by X is true,
and fails if it is false.
Rule
check-true(true) ~> null-value
Rule
check-true(false) ~> failFuncon
checked(_:(T)?) : =>Tchecked(X) fails when X gives the empty sequence of values ( ),
representing that an optional value has not been computed. It otherwise
computes the same as X.
____
From the [PLanCompS Project] | [CBS-beta issues...] | [Suggest an improvement...]
[Failing.cbs]: Failing.cbs
"CBS SOURCE FILE"
[Funcons-beta]: /CBS-beta/docs/Funcons-beta
"FUNCONS-BETA"
[Unstable-Funcons-beta]: /CBS-beta/docs/Unstable-Funcons-beta
"UNSTABLE-FUNCONS-BETA"
[Languages-beta]: /CBS-beta/docs/Languages-beta
"LANGUAGES-BETA"
[Unstable-Languages-beta]: /CBS-beta/docs/Unstable-Languages-beta
"UNSTABLE-LANGUAGES-BETA"
[CBS-beta]: /CBS-beta "CBS-BETA"
[PLanCompS Project]: https://plancomps.github.io
"PROGRAMMING LANGUAGE COMPONENTS AND SPECIFICATIONS PROJECT HOME PAGE"
[CBS-beta issues...]: https://github.com/plancomps/CBS-beta/issues
"CBS-BETA ISSUE REPORTS ON GITHUB"
[Suggest an improvement...]: mailto:plancomps@gmail.com?Subject=CBS-beta%20-%20comment&Body=Re%3A%20CBS-beta%20specification%20at%20Computations/Abnormal/Failing/Failing.cbs%0A%0AComment/Query/Issue/Suggestion%3A%0A%0A%0ASignature%3A%0A
"GENERATE AN EMAIL TEMPLATE"