Chapter 9

Advanced Type Topics

In our presentation of the Testing and Test Control Notation Version 3 (TTCN-3) type system in the previous chapter, some aspects have been left out deliberately to allow for a more stringent presentation of the most important topics. However, these aspects are sufficiently fundamental (like type compatibility) or useful for particular applications (like the anytype, recursive type definitions and foreign type system support) that this book would be incomplete without them. These aspects will now be covered in this chapter.

9.1 Type Compatibility

Like many other programming languages, TTCN-3 is a statically typed language. This means that each entity in TTCN-3 is declared together with its type. For a variable, its type describes which values can be stored in the variable and how it can be used to form expressions. For a function, it is specified what values can be passed as parameters, and what values can be returned as return values. For a port, it is defined, which values can be sent and received via this port and so on. For each entity, its type is known statically from the program code. It can hence be used to catch ill-formed expressions. In the following, we will describe the rules used to determine whether an expression is well typed. These rules guide which assignments, expressions and parameter instantiations are considered type-safe.

We have already discussed TTCN-3's capabilities to define new types from existing types via subtyping (see ...

Get An Introduction to TTCN-3, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.