diff options
author | Zahary Karadjov <zahary@gmail.com> | 2018-04-20 11:44:13 +0300 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2018-06-16 16:46:32 +0300 |
commit | fb27357b6217f53dc882e83fc128da578ad51764 (patch) | |
tree | 9922a3180ce7ce445500925aedb38ba932cfcc62 /lib/system.nim | |
parent | 8633b1b3097e1627f16a52fc648f0e14c647a688 (diff) | |
download | Nim-fb27357b6217f53dc882e83fc128da578ad51764.tar.gz |
A minimal patch enabling the new typedesc and static types syntax
Diffstat (limited to 'lib/system.nim')
-rw-r--r-- | lib/system.nim | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/system.nim b/lib/system.nim index fb02fde23..15f952feb 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -179,10 +179,24 @@ proc unsafeAddr*[T](x: T): ptr T {.magic: "Addr", noSideEffect.} = ## Cannot be overloaded. discard -proc `type`*(x: untyped): typeDesc {.magic: "TypeOf", noSideEffect, compileTime.} = - ## Builtin 'type' operator for accessing the type of an expression. - ## Cannot be overloaded. - discard +when defined(nimNewTypedesc): + type + `static`* {.magic: "Static".}[T] + ## meta type representing all values that can be evaluated at compile-time. + ## + ## The type coercion ``static(x)`` can be used to force the compile-time + ## evaluation of the given expression ``x``. + + `type`* {.magic: "Type".}[T] + ## meta type representing the type of all type values. + ## + ## The coercion ``type(x)`` can be used to obtain the type of the given + ## expression ``x``. +else: + proc `type`*(x: untyped): typeDesc {.magic: "TypeOf", noSideEffect, compileTime.} = + ## Builtin 'type' operator for accessing the type of an expression. + ## Cannot be overloaded. + discard proc `not` *(x: bool): bool {.magic: "Not", noSideEffect.} ## Boolean not; returns true iff ``x == false``. |