Files
Nim/lib/std/objectdollar.nim
metagn b8dc58d884 test removing dollar for objects out of system (#20242)
* test removing dollar for objects out of system

* test & fixes

* fix bootstrap

* use nimPreviewSlimSystem, test stdlib category

* fix test
2022-08-24 09:44:16 +02:00

12 lines
310 B
Nim

import std/private/miscdollars
proc `$`*[T: object](x: T): string =
## Generic `$` operator for objects with similar output to
## `$` for named tuples.
runnableExamples:
type Foo = object
a, b: int
let x = Foo(a: 23, b: 45)
assert $x == "(a: 23, b: 45)"
tupleObjectDollar(result, x)