Merge pull request #1446 from gradha/pr_links_typetraits_module
Links typetraits module
This commit is contained in:
commit
0db99beecb
3 changed files with 26 additions and 4 deletions
|
|
@ -56,7 +56,10 @@ Core
|
||||||
|
|
||||||
* `typeinfo <typeinfo.html>`_
|
* `typeinfo <typeinfo.html>`_
|
||||||
Provides (unsafe) access to Nimrod's run time type information.
|
Provides (unsafe) access to Nimrod's run time type information.
|
||||||
|
|
||||||
|
* `typetraits <typetraits.html>`_
|
||||||
|
This module defines compile-time reflection procs for working with types.
|
||||||
|
|
||||||
* `actors <actors.html>`_
|
* `actors <actors.html>`_
|
||||||
Actor support for Nimrod; implemented as a layer on top of the threads and
|
Actor support for Nimrod; implemented as a layer on top of the threads and
|
||||||
channels modules.
|
channels modules.
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,26 @@
|
||||||
## working with types
|
## working with types
|
||||||
|
|
||||||
proc name*(t: typedesc): string {.magic: "TypeTrait".}
|
proc name*(t: typedesc): string {.magic: "TypeTrait".}
|
||||||
## Returns the name of the given type
|
## Returns the name of the given type.
|
||||||
|
##
|
||||||
|
## Example:
|
||||||
|
##
|
||||||
|
## .. code-block::
|
||||||
|
##
|
||||||
|
## import typetraits
|
||||||
|
##
|
||||||
|
## proc `$`*[T](some:typedesc[T]): string = name(T)
|
||||||
|
##
|
||||||
|
## template test(x): stmt =
|
||||||
|
## echo "type: ", type(x), ", value: ", x
|
||||||
|
##
|
||||||
|
## test 42
|
||||||
|
## # --> type: int, value: 42
|
||||||
|
## test "Foo"
|
||||||
|
## # --> type: string, value: Foo
|
||||||
|
## test(@['A','B'])
|
||||||
|
## # --> type: seq[char], value: @[A, B]
|
||||||
|
|
||||||
|
|
||||||
proc arity*(t: typedesc): int {.magic: "TypeTrait".}
|
proc arity*(t: typedesc): int {.magic: "TypeTrait".}
|
||||||
## Returns the arity of the given type
|
## Returns the arity of the given type
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ doc: "tools;niminst;nimgrep;gc;estp;idetools;docgen;koch;backends.txt"
|
||||||
pdf: "manual;lib;tut1;tut2;nimrodc;niminst;gc"
|
pdf: "manual;lib;tut1;tut2;nimrodc;niminst;gc"
|
||||||
srcdoc2: "system.nim;impure/graphics;wrappers/sdl"
|
srcdoc2: "system.nim;impure/graphics;wrappers/sdl"
|
||||||
srcdoc2: "core/macros;pure/marshal;core/typeinfo;core/unsigned"
|
srcdoc2: "core/macros;pure/marshal;core/typeinfo;core/unsigned"
|
||||||
srcdoc2: "impure/re;pure/sockets"
|
srcdoc2: "impure/re;pure/sockets;pure/typetraits"
|
||||||
srcdoc: "system/threads.nim;system/channels.nim;js/dom"
|
srcdoc: "system/threads.nim;system/channels.nim;js/dom"
|
||||||
srcdoc2: "pure/os;pure/strutils;pure/math;pure/matchers;pure/algorithm"
|
srcdoc2: "pure/os;pure/strutils;pure/math;pure/matchers;pure/algorithm"
|
||||||
srcdoc2: "pure/complex;pure/times;pure/osproc;pure/pegs;pure/dynlib"
|
srcdoc2: "pure/complex;pure/times;pure/osproc;pure/pegs;pure/dynlib"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue