Topic: conditional control by guards

topics > computer science > programming > program control > Group: conditional control

case statement
conditional statement language
critical regions
decision table
event controlled processing
if-then-else test chain
production systems


Guards allow statement execution under selected conditions. Guards were formally presented by Dijkstra, but have been used for many years.

For example, a boolean switch may control block execution; if statements control statement execution; where clauses can be attached to syntactic rules; set membership is controlled by guards; loop exit may be guarded; RPG output is controlled by guards; post conditionals are applied to references; commands may be conditional; and, function return may be guarded. Guards may be applied to each statement in a block.

If the guards are mutually exclusive then the block forms a case statement with guards as indices. If the guards aren't mutually exclusive then execution may be indeterminate. Dijkstra's proof techniques handle the potential indeterminacy. Guarded statements may define a meaning for the occurrence of its guards. This is used in some control systems where every statement is guarded by tests on the current system state. (cbb 5/80)

Subtopic: guarded commands up

Quote: given a guarded command set, and do..od executes exactly one of the true guards
Quote: given a guarded command set, errors if all false, do..od fails if all false [»dijkEW_1977, OK]
Quote: if activation condition is false, a flow node's value is either frozen or a default value; deactivation by clocks too restrictive [»benvA1_2003]
Quote: an alternative command executes exactly one guarded command; a repetitive command executes alternative commands until fail
Quote: a guarded command executed only if its guard is true [»hoarCA8_1978]
Quote: a plan is a set of assignments with indices; e.g., true/false indices and a boolean indexer [»hehnEC3_1978, OK]
Quote: '@T(...)' denotes the event of a condition becoming true; can be guarded with a 'when' clause [»heniKL1_1980]
Quote: in CSP, (x->P | y->Q) describes an object that engages in events x or y and then behaves as process P or Q [»hoarCA_1985]
QuoteRef: weinGM8_1975 ;;36 SELECT every action statement consists of WHEN (condition i) is false//action i// when any are selected//action n+1// when none are selected// action n+1// end select (all false or all true)
QuoteRef: weinGM8_1975 ;;36 on condition select test for true or false on all conditions
QuoteRef: seedH_1971 ;;47 occurrence of output by boolean combination of indicators at proper point in cycle (eg detail printing time)
QuoteRef: schuSA_1970 ;;15 syntactic macros with a where clause as a guard

Subtopic: insufficient vs. inconsistent info up

Quote: in a constraint, if insufficient information to run a rule then ignore; if inconsistent information, then fail [»deutLP1_1981]

Subtopic: guarded regions for parallel processing up

Quote: a guarded region delays until one of its conditions is true; similar to a guarded command but does not raise an exception [»brinP9_1978]
Quote: input and output are basic programming primitives and parallel composition is a fundamental program structure method; use guarded commands [»hoarCA8_1978]
Quote: the set of context flags select which processors execute an instruction; e.g., all odd-numbered processors. Intersection, union, and complement are fast [»hillWD12_1986]
Quote: the parallel composition of guarded microsteps has confusing semantics and multiple interpretations; used by VHDL, Verilog, and others

Related Topics up

Topic: case statement (25 items)
Topic: conditional statement language (5 items)
Topic: critical regions (58 items)
Topic: decision table (29 items)
Topic: event controlled processing (46 items)
Topic: if-then-else test chain (18 items)
Topic: production systems
(10 items)

Updated barberCB 4/04
Copyright © 2002-2008 by C. Bradford Barber. All rights reserved.
Thesa is a trademark of C. Bradford Barber.