summary refs log tree commit diff stats
path: root/doc/astspec.txt
diff options
context:
space:
mode:
authorapense <apense@users.noreply.github.com>2015-06-15 16:27:53 -0400
committerapense <apense@users.noreply.github.com>2015-06-15 16:27:53 -0400
commit8c8e975bcd286b41e8308a6deab0f1d00849c681 (patch)
treeee03d55ad1ad1ad9866782b051be7af0eb603617 /doc/astspec.txt
parent3c9d655b883129765c3716c209dee5d38d72f8f6 (diff)
downloadNim-8c8e975bcd286b41e8308a6deab0f1d00849c681.tar.gz
Added static types
I put this within the type section, but I'm not sure if it should go here. It has a broader use. Should it get its own section?
Diffstat (limited to 'doc/astspec.txt')
-rw-r--r--doc/astspec.txt20
1 files changed, 20 insertions, 0 deletions
diff --git a/doc/astspec.txt b/doc/astspec.txt
index 6b64e5b91..ef0c91bb8 100644
--- a/doc/astspec.txt
+++ b/doc/astspec.txt
@@ -878,6 +878,26 @@ AST:
     # ...
   )
 
+Static types, like ``static[int]``, use ``nnkIdent`` wrapped in 
+``nnkStaticTy``.
+
+Concrete syntax:
+
+.. code-block:: nim
+  type A[T: static[int]] = object
+
+AST:
+
+.. code-block:: nim
+  # ... within nnkGenericParams
+  nnkIdentDefs(
+    nnkIdent(!"T"),
+    nnkStaticTy(
+      nnkIdent(!"int")
+    ),
+    nnkEmpty()
+  )
+  # ...
 
 Procedure declaration
 ---------------------