Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

typename

look up and return a named type

Synopsis

typename(name: string) -> type

Description

The typename function returns the type of the named type given by name if it exists. Otherwise, error("missing") is returned.

Examples


Return a simple named type with a string constant argument

# spq
values typename("port")
# input
type port=int16
80::port
# expected output
type port=int16
<port>

Return a named type using an expression

# spq
values typename(name)
# input
type port=int16
{name:"port",p:80::port}
# expected output
type port=int16
<port>

The result is error("missing") if the type name does not exist

# spq
values typename("port")
# input
80
# expected output
error("missing")