Expressions - CAST to HAC Migration Guide
Description: CAST to HAC Migration Guide

Next: Loops, Previous: Connections, Up: Top

## 7 Expressions

Expressions in HAC depart somewhat from CAST style and follow from ANSI C grammar more closely. Here we list a few differences.

The equality operator in CAST was `=`, but C and HAC use `==`. However, use of the deprecated `=` operator is allowed if the expression is wrapped in parentheses, e.g. `(x=y)`.

Less-than '<' and greater-than '>' operators now need to be parenthesized to dismbiguate them from template parameter delimiters, See Templates. For example, in CAST, `[ X<Y -> ... ]` would need to be re-written in HAC `[ (X<Y) -> ... ]`.

Logical operators in CAST were `&` and `|`, but in C and HAC, they are respectively `&&` and `||`. This makes way for bitwise operators (on integers) `&` and `|`.

XOR (bitwise integer) is `^` in HAC.

Logical XOR (for booleans) current uses `!=` instead of `^`, however, overloading `^` might be added back at some point.

The standard boolean and integer operations are strictly type-checked. At compile-time, there is no implicit conversion between `pbool` and `pint` values. For example, one cannot use an integer expression as a boolean, whereas in C, the integer is implicitly compared against 0.

Explicit casting operators may be added in the future.

Function expressions may be added in the future.