commit 80c20f20976758b3214e0227baa00a8805e769c4 parent 84cd44300015c80cd48d192cc5349cdd0ba994be Author: Drew DeVault <firstname.lastname@example.org> Date: Tue, 5 Oct 2021 14:28:23 +0200 types: add README Signed-off-by: Drew DeVault <email@example.com> Diffstat:
1 file changed, 14 insertions(+), 0 deletions(-)
diff --git a/types/README b/types/README @@ -0,0 +1,14 @@ +The types module provides runtime access to the Hare type system. It provides +constants like [[INT_MAX]], which defines the useful range for integer types +(see [[math]] for f32 and f64 limits), as well as types like [[slice_repr]], +which describe the internal structure of data types like slices and str. + +The types module additionally provides support for reflection. A typical program +which needs to make use of reflection will pass a type value to [[reflect]], +like so: + + let info = types::reflect(type(str)); + assert(info.repr is types::builtin::STR); + +Additional helpers like [[unwrap]] are provided to further assist with +reflection-related tasks.