From: Jérémie Astor Date: Thu, 1 Oct 2020 18:57:40 +0000 (+0200) Subject: Start type aliases docs X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=22853e1463e4f5089844fd90214a99eb063f8fe2;p=gwion.git Start type aliases docs --- diff --git a/docs/Reference/Types/Typedefs.mdr b/docs/Reference/Types/Typedefs.mdr index a64999b2..332cde61 100644 --- a/docs/Reference/Types/Typedefs.mdr +++ b/docs/Reference/Types/Typedefs.mdr @@ -1 +1,28 @@ -# Typedefs +# Type aliases + +Create an alias for a previously defined type. + +@``` typedef_simple.gw +typedef int MyInt; +var MyInt i; +<<< i >>>; +<<< i $ int >>>; +@``` + +Aliases can also point to an array type + +@``` typedef_array.gw +typedef float[3] Point; +var Point p; +foreach(a : p) + <<< a >>>; +@``` + + +Aliases can be used to refer to a type family + +@``` typedef_tmpl.gw +typedef Ptr:[int] IntPtr; +var IntPtr int_ptr; +<<< int_ptr >>>; +@```