rename lenTuple and lenVarargs (#13639)
* rename 'lenTuple' to 'tupleLen' Rationale: `lenTuple` is a tuple consisting of lengths (e.g. `(1, 5, 0)`), `tupleLen` is a length of a tuple (e.g. `tupleLen((1, 5, 0) == 3`) * rename 'lenVarargs' to 'varargsLen' The same rationale as a previous commit. Consistency.
This commit is contained in:
parent
f0cd50f9c4
commit
14b2354b7d
6 changed files with 33 additions and 32 deletions
|
|
@ -72,13 +72,13 @@ proc distinctBase*(T: typedesc): typedesc {.magic: "TypeTrait".}
|
|||
## compile time error otherwise
|
||||
|
||||
|
||||
proc lenTuple*(T: typedesc[tuple]): int {.magic: "TypeTrait", since: (1, 1).}
|
||||
proc tupleLen*(T: typedesc[tuple]): int {.magic: "TypeTrait", since: (1, 1).}
|
||||
## Return number of elements of `T`
|
||||
|
||||
since (1, 1):
|
||||
template lenTuple*(t: tuple): int =
|
||||
template tupleLen*(t: tuple): int =
|
||||
## Return number of elements of `t`
|
||||
lenTuple(type(t))
|
||||
tupleLen(type(t))
|
||||
|
||||
since (1, 1):
|
||||
template get*(T: typedesc[tuple], i: static int): untyped =
|
||||
|
|
|
|||
|
|
@ -2682,10 +2682,10 @@ when defined(nimV2):
|
|||
import system/repr_v2
|
||||
export repr_v2
|
||||
|
||||
macro lenVarargs*(x: varargs[untyped]): int {.since: (1, 1).} =
|
||||
macro varargsLen*(x: varargs[untyped]): int {.since: (1, 1).} =
|
||||
## returns number of variadic arguments in `x`
|
||||
proc lenVarargsImpl(x: NimNode): NimNode {.magic: "LengthOpenArray", noSideEffect.}
|
||||
lenVarargsImpl(x)
|
||||
proc varargsLenImpl(x: NimNode): NimNode {.magic: "LengthOpenArray", noSideEffect.}
|
||||
varargsLenImpl(x)
|
||||
|
||||
when false:
|
||||
template eval*(blk: typed): typed =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue