Fail-stop
Encyclopedia
A fail-stop subset of a computer language is one that has the same semantics
as the original, except in the case where an exceptional condition
arises. The fail-stop subset must report an exceptional condition whenever the superset language reports one, but may additionally report an exceptional condition in other cases.
Fail-stop languages are often used in computer systems where correctness is very important, since it is easier to make such systems fail-fast
. For example, the "+" operator in many programming languages is not associative
because of the possibility of overflow
. Repairing these languages to fail fast when commonly assumed properties do not hold, makes it much easier to write and verify correct code.
But in a fail-stop language that treats overflow as an exceptional condition, it is either correct, or will terminate with an exceptional condition.
Formal semantics of programming languages
In programming language theory, semantics is the field concerned with the rigorous mathematical study of the meaning of programming languages and models of computation...
as the original, except in the case where an exceptional condition
Exception handling
Exception handling is a programming language construct or computer hardware mechanism designed to handle the occurrence of exceptions, special conditions that change the normal flow of program execution....
arises. The fail-stop subset must report an exceptional condition whenever the superset language reports one, but may additionally report an exceptional condition in other cases.
Fail-stop languages are often used in computer systems where correctness is very important, since it is easier to make such systems fail-fast
Fail-fast
Fail-fast is a property of a system or module with respect to its response to failures. A fail-fast system is designed to immediately report at its interface any failure or condition that is likely to lead to failure. Fail-fast systems are usually designed to stop normal operation rather than...
. For example, the "+" operator in many programming languages is not associative
Associativity
In mathematics, associativity is a property of some binary operations. It means that, within an expression containing two or more occurrences in a row of the same associative operator, the order in which the operations are performed does not matter as long as the sequence of the operands is not...
because of the possibility of overflow
Arithmetic overflow
The term arithmetic overflow or simply overflow has the following meanings.# In a computer, the condition that occurs when a calculation produces a result that is greater in magnitude than that which a given register or storage location can store or represent.# In a computer, the amount by which a...
. Repairing these languages to fail fast when commonly assumed properties do not hold, makes it much easier to write and verify correct code.
Examples
In many widely used programming languages the code below might reduce the bank account value if the deposited amount or old account value is very large, by causing an overflowed value to be assigned to new_bank_account_value.But in a fail-stop language that treats overflow as an exceptional condition, it is either correct, or will terminate with an exceptional condition.