I have a table member of an object declared as such
entries: Table[string, string]
Run
And I was returning it with this
proc getAll*(this: JotzCollection): Table[string, string] =
return this.entries
Run
When I try to get its length
assert(collection.getAll().len == 2)
Run
I get a spew of errors
Error: type mismatch: got <Table[system.string, system.string]>
but expected one of:
func len(x: (type array) | array): int
first type mismatch at position: 1
required type for x: typedesc[array] or array
but expression 'getAll(collection)' is of type: Table[system.string,
system.string]
func len(x: string): int
first type mismatch at position: 1
required type for x: string
but expression 'getAll(collection)' is of type: Table[system.string,
system.string]
func len[TOpenArray: openArray | varargs](x: TOpenArray): int
first type mismatch at position: 1
required type for x: TOpenArray: openArray or varargs
but expression 'getAll(collection)' is of type: Table[system.string,
system.string]
func len[T](x: seq[T]): int
first type mismatch at position: 1
required type for x: seq[T]
but expression 'getAll(collection)' is of type: Table[system.string,
system.string]
func len[T](x: set[T]): int
first type mismatch at position: 1
required type for x: set[T]
but expression 'getAll(collection)' is of type: Table[system.string,
system.string]
proc len(w: WideCString): int
first type mismatch at position: 1
required type for w: WideCString
but expression 'getAll(collection)' is of type: Table[system.string,
system.string]
proc len(x: cstring): int
first type mismatch at position: 1
required type for x: cstring
but expression 'getAll(collection)' is of type: Table[system.string,
system.string]
proc len[U: Ordinal; V: Ordinal](x: HSlice[U, V]): int
first type mismatch at position: 1
required type for x: HSlice[len.U, len.V]
but expression 'getAll(collection)' is of type: Table[system.string,
system.string]
expression: len(getAll(collection))
Run
This seems to be telling me there is no len function for tables? I can call len
just fine on the table from within the proc. What am I missing? Thanks!