4.13.9 Type Casting

When two operands on each side of a binary expression have different type, mailfromd evaluator coerces them to a common type. This is known as implicit type casting. The rules for implicit type casting are:

  1. Both arguments to an arithmetical operation are cast to numeric type.
  2. Both arguments to the concatenation operation are cast to string.
  3. Both arguments to `match' or `fnmatch' function are cast to string.
  4. The argument of the unary negation (arithmetical or boolean) is cast to numeric.
  5. Otherwise the right-hand side argument is cast to the type of the left-hand side argument.

The construct for explicit type cast is:

 
type(expr)

where type is the name of the type to coerce expr to. For example:

 
string(2 + 4*8) ⇒ "34"