summary refs log tree commit diff stats
path: root/lib/std/private/since.nim
blob: e4aecb61ae4f7c363d492ba6469088372241752f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
template since*(version: (int, int), body: untyped) {.dirty.} =
  ## Evaluates `body` if the ``(NimMajor, NimMinor)`` is greater than
  ## or equal to `version`. Usage:
  ##
  ## .. code-block:: Nim
  ##   proc fun*() {.since: (1, 3).}
  ##   since (1, 3): fun()
  when (NimMajor, NimMinor) >= version:
    body

template since*(version: (int, int, int), body: untyped) {.dirty.} =
  ## Evaluates `body` if ``(NimMajor, NimMinor, NimPatch)`` is greater than 
  ## or equal to `version`. Usage:
  ##
  ## .. code-block:: Nim
  ##   proc fun*() {.since: (1, 3, 1).}
  ##   since (1, 3, 1): fun()
  when (NimMajor, NimMinor, NimPatch) >= version:
    body