Indeed but then each container has it's own implementation since system.nim cannot know the internals.
So from there: <https://github.com/nim-lang/Nim/blob/e08b802d/lib/system.nim#L291-L361>, I suggest deprecating the first one: proc high*[T: Ordinal|enum|range](x: T): T {.magic: "High", noSideEffect.} ## 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>`_ ## ## .. code-block:: Nim ## high(2) # => 9223372036854775807 proc high*[T: Ordinal|enum|range](x: typedesc[T]): T {.magic: "High", noSideEffect.} ## Returns the highest possible value of an ordinal or enum type. ## ## ``high(int)`` is Nim's way of writing `INT_MAX`:idx: or `MAX_INT`:idx:. ## ## See also: ## * `low(typedesc) <#low,typedesc[T]>`_ ## ## .. code-block:: Nim ## high(int) # => 9223372036854775807 proc high*[T](x: openArray[T]): int {.magic: "High", noSideEffect.} ## Returns the highest possible index of a sequence `x`. ## ## See also: ## * `low(openArray) <#low,openArray[T]>`_ ## ## .. code-block:: Nim ## var s = @[1, 2, 3, 4, 5, 6, 7] ## high(s) # => 6 ## for i in low(s)..high(s): ## echo s[i] proc high*[I, T](x: array[I, T]): I {.magic: "High", noSideEffect.} ## Returns the highest possible index of an array `x`. ## ## See also: ## * `low(array) <#low,array[I,T]>`_ ## ## .. code-block:: Nim ## var arr = [1, 2, 3, 4, 5, 6, 7] ## high(arr) # => 6 ## for i in low(arr)..high(arr): ## echo arr[i] proc high*[I, T](x: typedesc[array[I, T]]): I {.magic: "High", noSideEffect.} ## Returns the highest possible index of an array type. ## ## See also: ## * `low(typedesc[array]) <#low,typedesc[array[I,T]]>`_ ## ## .. code-block:: Nim ## high(array[7, int]) # => 6 proc high*(x: cstring): int {.magic: "High", noSideEffect.} ## Returns the highest possible index of a compatible string `x`. ## This is sometimes an O(n) operation. ## ## See also: ## * `low(cstring) <#low,cstring>`_ proc high*(x: string): int {.magic: "High", noSideEffect.} ## Returns the highest possible index of a string `x`. ## ## See also: ## * `low(string) <#low,string>`_ ## ## .. code-block:: Nim ## var str = "Hello world!" ## high(str) # => 11 Run
