Types & safe values · BUILT-IN MODULE

typing

Runtime type inspection helpers.

Quick start

use typing
use typing

value = 42
say typing.type_of value
say typing.is value "Int"
say typing.cast value "Int"

API reference

typing.type_of value

Return the runtime SE type name.

回傳 runtime 中的 SE 型別名稱。
typing.is value type_name

Check the runtime type name.

檢查 runtime 型別名稱。
typing.cast value type_name

Assert a runtime type and return the value.

確認 runtime 型別後回傳原值。