std.types#
mars
takepkg std.types;
family Shape{}
family Circle(Shape){}
func m{
c = Circle();
out(types.kind(c), types.family_name(c)); // instance Circle
out(types.is_instance(c, Shape)); // true
}
| Function | Result |
|---|---|
kind(value) |
"int", "longint", "float", "bigint", "string", "bool", "null", "array", "set", "map", "pair", "instance", "function", "package", "date", "datetime", or "duration" |
family_name(value) |
The family name of an instance, or of a family itself (family_name(RangeError) is "RangeError"), or null |
is_instance(value, Family) |
Whether value is an instance of Family or of a family inheriting from it |
is_number(value) |
Whether value is an int, longint, float, or bigint |