NAME

typecheck - ensure that a value is derived from a specified Type

SYNOPSIS

oadl::typecheck(val,typ)

DESCRIPTION

The typecheck() intrinsic procedure checks to see whether a value is derived from a given type. For scalar types, this is a fairly trivial check. For array and object types, it is more complicated. See documentation of oadl::is_a() for a detailed description of how type derivation is determinted.

RETURN VALUE

oadl::typecheck() always returns true on success. On failure, a TypeCheck exception is thrown.

ERRORS

TypeCheck when the value and type do not match

EXAMPLE

    oadl::typecheck(String, "foobar")
true

    oadl::typecheck(Array[*], "foobar")
true

    oadl::typecheck(Array, "foobar")
Illegal type

SEE ALSO

is_a