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?
This commit is contained in:
parent
3c9d655b88
commit
8c8e975bcd
1 changed files with 20 additions and 0 deletions
|
|
@ -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
|
Procedure declaration
|
||||||
---------------------
|
---------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue