typename
Function
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:
values typename("port")
80::port=int16
Loading...
echo '80::port=int16' \
| super -s -c 'values typename("port")' -
Return a named type using an expression:
values typename(name)
{name:"port",p:80::port=int16}
Loading...
echo '{name:"port",p:80::port=int16}' \
| super -s -c 'values typename(name)' -
The result is error("missing")
if the type name does not exist:
values typename("port")
80
Loading...
echo '80' \
| super -s -c 'values typename("port")' -