Type constructors .
. Pointer : if T is a type expression then pointer( T ) is a type expression denoting type pointer to an object of type T
. Function : function maps domain set to range set. It is denoted by type expression D R
- For example mod has type expression int x int int
- function f( a, b: char ) : ^ integer; is denoted by
char x char pointer( integer )
Pointers:
If T is a type expression, then pointer ( T ) is a type expression denoting the type "pointer to an object of type T". For example, in Pascal, the declaration
var p: row
declares variable p to have type pointer( row ).
Functions
Analogous to mathematical functions, functions in programming languages may be defined as mapping a domain type D to a range type R. The type of such a function is denoted by the type expression D R. For example, the built-in function mod of Pascal has domain type int X int, and range type int . Thus we say mod has the type:
int x int -> int
As another example, according to the Pascal declaration
function f(a, b: char) : integer;
Here the type of f is denoted by the type expression
char X char pointer( integer )
|