# system/repr_v2

Theme:

- Manual
- Standard library
- Index
- Compiler docs
- Fusion docs
- devel, stable

Search:
Source Edit

# Imports

formatfloat

# Procs

    proc repr(p: pointer): string {....raises: [], tags: [], forbids: [].}

  repr of pointer as its hexadecimal value Source Edit

    proc repr(p: proc | iterator {.closure.}): string

  repr of a proc as its address Source Edit

    proc repr(x: bool): string {.magic: "BoolToStr", noSideEffect, ...raises: [],
                                 tags: [], forbids: [].}

  repr for a boolean argument. Returns `x` converted to the string "false" or "true". Source Edit

    proc repr(x: char): string {.noSideEffect, ...raises: [], tags: [], forbids: [].}

  repr for a character argument. Returns `x` converted to an escaped string.

      assert repr('c') == "'c'"

  Source Edit

    proc repr(x: NimNode): string {.magic: "Repr", noSideEffect, ...raises: [],
                                    tags: [], forbids: [].}

  Source Edit

    proc repr(x: string | cstring): string {.noSideEffect, ...raises: [].}

  repr for a string argument. Returns `x` converted to a quoted and escaped string. Source Edit

    proc repr(x`gensym0: int): string {.noSideEffect, ...raises: [], tags: [],
                                        forbids: [].}

  Same as $x Source Edit

    proc repr(x`gensym1: int8): string {.noSideEffect, ...raises: [], tags: [],
                                         forbids: [].}

  Same as $x Source Edit

    proc repr(x`gensym2: int16): string {.noSideEffect, ...raises: [], tags: [],
                                          forbids: [].}

  Same as $x Source Edit

    proc repr(x`gensym3: int32): string {.noSideEffect, ...raises: [], tags: [],
                                          forbids: [].}

  Same as $x Source Edit

    proc repr(x`gensym4: int64): string {.noSideEffect, ...raises: [], tags: [],
                                          forbids: [].}

  Same as $x Source Edit

    proc repr(x`gensym5: uint): string {.noSideEffect, ...raises: [], tags: [],
                                         forbids: [].}

  Same as $x Source Edit

    proc repr(x`gensym6: uint8): string {.noSideEffect, ...raises: [], tags: [],
                                          forbids: [].}

  Same as $x Source Edit

    proc repr(x`gensym7: uint16): string {.noSideEffect, ...raises: [], tags: [],
                                           forbids: [].}

  Same as $x Source Edit

    proc repr(x`gensym8: uint32): string {.noSideEffect, ...raises: [], tags: [],
                                           forbids: [].}

  Same as $x Source Edit

    proc repr(x`gensym9: uint64): string {.noSideEffect, ...raises: [], tags: [],
                                           forbids: [].}

  Same as $x Source Edit

    proc repr(x`gensym10: float): string {.noSideEffect, ...raises: [], tags: [],
                                           forbids: [].}

  Same as $x Source Edit

    proc repr(x`gensym11: float32): string {.noSideEffect, ...raises: [], tags: [],
        forbids: [].}

  Same as $x Source Edit

    proc repr[Enum: enum](x: Enum): string {.magic: "EnumToStr", noSideEffect,
        ...raises: [], tags: [], forbids: [].}

  repr for an enumeration argument. This works for any enumeration type thanks to compiler magic.

  If a `repr` operator for a concrete enumeration is provided, this is used instead. (In other words: Overwriting is possible.)

  Source Edit

    proc repr[T, IDX](x: array[IDX, T]): string

  Generic `repr` operator for arrays that is lifted from the components. Source Edit

    proc repr[T: tuple | object](x: T): string {.noSideEffect, ...raises: [].}

  Generic `repr` operator for tuples that is lifted from the components of `x`. Example:

      $(23, 45) == "(23, 45)"
      $(a: 23, b: 45) == "(a: 23, b: 45)"
      $() == "()"

  Source Edit

    proc repr[T](x: openArray[T]): string

  Generic `repr` operator for openarrays that is lifted from the components of `x`. Example:

      $(@[23, 45].toOpenArray(0, 1)) == "[23, 45]"

  Source Edit

    proc repr[T](x: ref T | ptr T): string {.noSideEffect, ...raises: [].}

  Source Edit

    proc repr[T](x: seq[T]): string

  Generic `repr` operator for seqs that is lifted from the components of `x`. Example:

      $(@[23, 45]) == "@[23, 45]"

  Source Edit

    proc repr[T](x: set[T]): string

  Generic `repr` operator for sets that is lifted from the components of `x`. Example:

      ${23, 45} == "{23, 45}"

  Source Edit

    proc repr[T](x: UncheckedArray[T]): string

  Source Edit

    proc reprDiscriminant(e: int): string {.compilerproc, ...raises: [], tags: [],
                                            forbids: [].}

  Source Edit

# Templates

    template repr(t: typedesc): string

  Source Edit

    template repr[T: distinct | (range and not enum)](x: T): string

  Source Edit