TreatExpr

Modify static type of operand.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

TreatExpr

graphics/TreatExpr.png

Expr SequenceType

Description

A TreatExpr modifies the static type of its operand and takes an expression and a sequence type as arguments. It does not change the dynamic type; rather, it ensures that an expression has an expected dynamic type at evaluation time.

Example

  • The static type of $myaddress may be Address, a less specific type than USAddress. However, at run-time, the value of $myaddress must match the type USAddress using rules for SequenceType matching; otherwise a dynamic error is raised.

    $myaddress treat as element()