mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-06 04:57:49 +00:00
manual: more documentation for the 'using' statement; closes #8565
This commit is contained in:
@@ -17,8 +17,7 @@ About this document
|
||||
===================
|
||||
|
||||
**Note**: This document is a draft! Several of Nim's features may need more
|
||||
precise wording. This manual is constantly evolving until the 1.0 release and is
|
||||
not to be considered as the final proper specification.
|
||||
precise wording. This manual is constantly evolving into a proper specification.
|
||||
|
||||
This document describes the lexis, the syntax, and the semantics of Nim.
|
||||
|
||||
@@ -2985,6 +2984,10 @@ name ``c`` should default to type ``Context``, ``n`` should default to
|
||||
proc bar(c, n, counter) = ...
|
||||
proc baz(c, n) = ...
|
||||
|
||||
proc mixedMode(c, n; x, y: int) =
|
||||
# 'c' is inferred to be of the type 'Context'
|
||||
# 'n' is inferred to be of the type 'Node'
|
||||
# But 'x' and 'y' are of type 'int'.
|
||||
|
||||
The ``using`` section uses the same indentation based grouping syntax as
|
||||
a ``var`` or ``let`` section.
|
||||
@@ -2992,6 +2995,9 @@ a ``var`` or ``let`` section.
|
||||
Note that ``using`` is not applied for ``template`` since untyped template
|
||||
parameters default to the type ``system.untyped``.
|
||||
|
||||
Mixing parameters that should use the ``using`` declaration with parameters
|
||||
that are explicitly typed is possible and requires a semicolon between them.
|
||||
|
||||
|
||||
If expression
|
||||
-------------
|
||||
|
||||
Reference in New Issue
Block a user