diff options
author | Miran <narimiran@disroot.org> | 2020-09-09 12:43:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-09 12:43:04 +0200 |
commit | 7d4f0df107fdce5d1da93e26e54dd87526a0a74f (patch) | |
tree | dfddda174162971d14db95782fa0325dba017693 /lib/system.nim | |
parent | f3552b86c15ea487910c71f75f31d0a25d0e5890 (diff) | |
download | Nim-7d4f0df107fdce5d1da93e26e54dd87526a0a74f.tar.gz |
deprecate `high(value)` and `low(value)` (#15283)
Diffstat (limited to 'lib/system.nim')
-rw-r--r-- | lib/system.nim | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/system.nim b/lib/system.nim index dc603b56d..0a8c52908 100644 --- a/lib/system.nim +++ b/lib/system.nim @@ -288,13 +288,14 @@ else: type sink*[T]{.magic: "BuiltinType".} type lent*[T]{.magic: "BuiltinType".} -proc high*[T: Ordinal|enum|range](x: T): T {.magic: "High", noSideEffect.} +proc high*[T: Ordinal|enum|range](x: T): T {.magic: "High", noSideEffect, + deprecated: "Deprecated since v1.4; there should not be `high(value)`. Use `high(type)`.".} ## Returns the highest possible value of an ordinal value `x`. ## ## As a special semantic rule, `x` may also be a type identifier. ## - ## See also: - ## * `low(T) <#low,T>`_ + ## **This proc is deprecated**, use this one instead: + ## * `high(typedesc) <#high,typedesc[T]>`_ ## ## .. code-block:: Nim ## high(2) # => 9223372036854775807 @@ -360,12 +361,13 @@ proc high*(x: string): int {.magic: "High", noSideEffect.} ## var str = "Hello world!" ## high(str) # => 11 -proc low*[T: Ordinal|enum|range](x: T): T {.magic: "Low", noSideEffect.} +proc low*[T: Ordinal|enum|range](x: T): T {.magic: "Low", noSideEffect, + deprecated: "Deprecated since v1.4; there should not be `low(value)`. Use `low(type)`.".} ## Returns the lowest possible value of an ordinal value `x`. As a special ## semantic rule, `x` may also be a type identifier. ## - ## See also: - ## * `high(T) <#high,T>`_ + ## **This proc is deprecated**, use this one instead: + ## * `low(typedesc) <#low,typedesc[T]>`_ ## ## .. code-block:: Nim ## low(2) # => -9223372036854775808 |