Merge pull request #1446 from gradha/pr_links_typetraits_module

Links typetraits module
This commit is contained in:
Varriount
2014-08-06 22:54:35 -04:00
3 changed files with 26 additions and 4 deletions

View File

@@ -56,7 +56,10 @@ Core
* `typeinfo <typeinfo.html>`_
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>`_
Actor support for Nimrod; implemented as a layer on top of the threads and
channels modules.

View File

@@ -11,7 +11,26 @@
## working with types
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".}
## Returns the arity of the given type
## Returns the arity of the given type

View File

@@ -41,7 +41,7 @@ doc: "tools;niminst;nimgrep;gc;estp;idetools;docgen;koch;backends.txt"
pdf: "manual;lib;tut1;tut2;nimrodc;niminst;gc"
srcdoc2: "system.nim;impure/graphics;wrappers/sdl"
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"
srcdoc2: "pure/os;pure/strutils;pure/math;pure/matchers;pure/algorithm"
srcdoc2: "pure/complex;pure/times;pure/osproc;pure/pegs;pure/dynlib"