since.nim 652 B

12345678910111213141516171819
  1. template since*(version: (int, int), body: untyped) {.dirty.} =
  2. ## Evaluates `body` if the ``(NimMajor, NimMinor)`` is greater than
  3. ## or equal to `version`. Usage:
  4. ##
  5. ## .. code-block:: Nim
  6. ## proc fun*() {.since: (1, 3).}
  7. ## since (1, 3): fun()
  8. when (NimMajor, NimMinor) >= version:
  9. body
  10. template since*(version: (int, int, int), body: untyped) {.dirty.} =
  11. ## Evaluates `body` if ``(NimMajor, NimMinor, NimPatch)`` is greater than
  12. ## or equal to `version`. Usage:
  13. ##
  14. ## .. code-block:: Nim
  15. ## proc fun*() {.since: (1, 3, 1).}
  16. ## since (1, 3, 1): fun()
  17. when (NimMajor, NimMinor, NimPatch) >= version:
  18. body