Updated documentation of system.new. Ref #2699.
This commit is contained in:
parent
202cc48903
commit
f8f9677205
1 changed files with 4 additions and 1 deletions
|
|
@ -178,7 +178,10 @@ proc new*[T](a: var ref T) {.magic: "New", noSideEffect.}
|
||||||
|
|
||||||
proc new*(T: typedesc): auto =
|
proc new*(T: typedesc): auto =
|
||||||
## creates a new object of type ``T`` and returns a safe (traced)
|
## creates a new object of type ``T`` and returns a safe (traced)
|
||||||
## reference to it as result value
|
## reference to it as result value.
|
||||||
|
##
|
||||||
|
## When ``T`` is a ref type then the resulting type will be ``T``,
|
||||||
|
## otherwise it will be ``ref T``.
|
||||||
when (T is ref):
|
when (T is ref):
|
||||||
var r: T
|
var r: T
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue