Capy-Bearer Documentation

Get a dynamic value type name

lib call

Capy

function get_type_name(value : dval) string

Description

get_type_name(value) reports the internal kind currently stored in a dval. Both maps and lists report array. A callable reports unknown.

This function is different from expression::type_name. The expression form reports the resolved static Capy type. A value with static type dval always reports dval, even when it currently stores a string.

Parameters

value : value to inspect

Return Values

One of String, f64, bool, array, none, pointer, reference, or unknown.

Example

Capy

var value : dval = dval("text")
print(value::type_name, " ", get_type_name(value), "\n")