deprecate high(value) and low(value) (#15283)
This commit is contained in:
parent
f3552b86c1
commit
7d4f0df107
1 changed files with 8 additions and 6 deletions
|
|
@ -288,13 +288,14 @@ else:
|
||||||
type sink*[T]{.magic: "BuiltinType".}
|
type sink*[T]{.magic: "BuiltinType".}
|
||||||
type lent*[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`.
|
## Returns the highest possible value of an ordinal value `x`.
|
||||||
##
|
##
|
||||||
## As a special semantic rule, `x` may also be a type identifier.
|
## As a special semantic rule, `x` may also be a type identifier.
|
||||||
##
|
##
|
||||||
## See also:
|
## **This proc is deprecated**, use this one instead:
|
||||||
## * `low(T) <#low,T>`_
|
## * `high(typedesc) <#high,typedesc[T]>`_
|
||||||
##
|
##
|
||||||
## .. code-block:: Nim
|
## .. code-block:: Nim
|
||||||
## high(2) # => 9223372036854775807
|
## high(2) # => 9223372036854775807
|
||||||
|
|
@ -360,12 +361,13 @@ proc high*(x: string): int {.magic: "High", noSideEffect.}
|
||||||
## var str = "Hello world!"
|
## var str = "Hello world!"
|
||||||
## high(str) # => 11
|
## 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
|
## Returns the lowest possible value of an ordinal value `x`. As a special
|
||||||
## semantic rule, `x` may also be a type identifier.
|
## semantic rule, `x` may also be a type identifier.
|
||||||
##
|
##
|
||||||
## See also:
|
## **This proc is deprecated**, use this one instead:
|
||||||
## * `high(T) <#high,T>`_
|
## * `low(typedesc) <#low,typedesc[T]>`_
|
||||||
##
|
##
|
||||||
## .. code-block:: Nim
|
## .. code-block:: Nim
|
||||||
## low(2) # => -9223372036854775808
|
## low(2) # => -9223372036854775808
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue