Legacy Issue Number: 12591
Source: Hewlett-Packard ( Faron Dutton)
Describe behavior of BinaryExpression. Some languages evaluate only the left hand side of a binary, Boolean expression if evaluating the right hand side would not change the result (i.e., short circuit evaluation). Some languages always evaluate both sides. Specification of this behavior in the GASTM promotes interoperability when translating from one language to another.
Reported: ASTM 1.0b1 — Sun, 27 Jul 2008 04:00 GMT
Disposition: Resolved — ASTM 1.0
Since logical binary operators (and, or) have evaluation semantics specified by language definition, it will be useful and important to include these semantics in the GASTM specification. There are three possibilities:
- We can assume that the default behavior is short-circuit semantics of evaluation. For other languages (e.g. VB), new operators can be defined in the SASTM for VB.
- Add an attribute (flag) for the binary logical operators (AND, OR) to indicate short-circuit evaluation. For this, we may have to introduce abstract classes for operators like logical operators, relational operators and mathematical operators
- Add new operators (ANDAND, OROR or any other suitable names) to specify short-circuit semantics of evaluation
TCS recommends the first option of attaching default (short-circuit) behavior.
Summary of changes:
The change to specification will be in section# <184.108.40.206.9>, page# <111>, line# <6>. New description added will be along the lines "Default behavior is short-circuit semantics of evaluation for binary operators And, Or, BitOr, BitAnd, BitXor".
A change to specification will also be in section# <2.11.7>, page# <56>, line# <47>. Create a reference to the semantics specified in the section 220.127.116.11.9 (described in previous para)
Updated: Fri, 6 Mar 2015 20:57 GMT