diff options
Diffstat (limited to 'docs/type_system/generic.md')
| -rw-r--r-- | docs/type_system/generic.md | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/docs/type_system/generic.md b/docs/type_system/generic.md new file mode 100644 index 0000000..2b9a89f --- /dev/null +++ b/docs/type_system/generic.md @@ -0,0 +1,32 @@ +# Generic + +--- + +```text +Generic[[TYPE | SYMBOL] TARGET; Collection[VAR_TREE_LIST; TYPE.SYMBOL]] +``` + +## Type Body Object Definitions + +```c +typedef struct { + kpl_type *target, *var_tree, *var_list; +} kpl_type_body_generic; +``` + +# Example + +```text +ints : Set[I64] $ () +/* +ints -> Name[[DATA] Var[[LOCAL] Generic[[TYPE] REF_SET; Symbol[Void; REF_I64; T]; ints]; ints] +REF_SET -> Name[[ALIAS] Map[Symbol[Void; Generic[[SYMBOL]]; T]; Void]; Set] +REF_I64 -> Name[[Alias] Bit[[BIT64 | INT_SIGNED]]; I64] +*/ +floats : Array[F64] $ () +/* +floats -> Name[[DATA] Var[[LOCAL] Generic[[TYPE] REF_ARRAY; Symbol[Void; REF_F64; T]; floats]; floats] +REF_ARRAY -> Name[[ALIAS] Buffer[[TYPE] Symbol[Void; Generic[[SYMBOL]]; T]; Array] +REF_F64 -> Name[[Alias] Bit[BIT64 | FLOAT]; F64] +*/ +``` |
