repr_v2.html 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <!-- This file is generated by Nim. -->
  4. <html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8. <title>system/repr_v2</title>
  9. <!-- Google fonts -->
  10. <link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
  11. <link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
  12. <!-- Favicon -->
  13. <link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
  14. <link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
  15. <!-- CSS -->
  16. <link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
  17. <!-- JS -->
  18. <script type="text/javascript" src="dochack.js?v=2.3.1"></script>
  19. </head>
  20. <body>
  21. <div class="document" id="documentId">
  22. <div class="container">
  23. <h1 class="title">system/repr_v2</h1>
  24. <div class="row">
  25. <div class="three columns">
  26. <div class="theme-select-wrapper">
  27. <label for="theme-select">Theme:&nbsp;</label>
  28. <select id="theme-select" onchange="setTheme(this.value)">
  29. <option value="auto">🌗 Match OS</option>
  30. <option value="dark">🌑 Dark</option>
  31. <option value="light">🌕 Light</option>
  32. </select>
  33. </div>
  34. <div id="global-links">
  35. <ul class="simple-boot">
  36. <li><a href="manual.html">Manual</a></li>
  37. <li><a href="lib.html">Standard library</a></li>
  38. <li> <a id="indexLink" href="theindex.html">Index</a></li>
  39. <li><a href="compiler/theindex.html">Compiler docs</a></li>
  40. <li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
  41. <li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
  42. </ul>
  43. </div>
  44. <div id="searchInputDiv">
  45. Search: <input type="search" id="searchInput"
  46. oninput="search()" />
  47. </div>
  48. <ul class="simple simple-toc" id="toc-list">
  49. <li>
  50. <a class="reference reference-toplevel" href="#6" id="56">Imports</a>
  51. </li>
  52. <li>
  53. <details open>
  54. <summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
  55. <ul class="simple simple-toc-section">
  56. <ul class="simple nested-toc-section">repr
  57. <li><a class="reference" href="#repr%2Cpointer" title="repr(p: pointer): string">repr(p: pointer): string</a></li>
  58. <li><a class="reference" href="#repr_2" title="repr(p: proc | iterator {.closure.}): string">repr(p: proc | iterator {.closure.}): string</a></li>
  59. <li><a class="reference" href="#repr%2Cbool" title="repr(x: bool): string">repr(x: bool): string</a></li>
  60. <li><a class="reference" href="#repr%2Cchar" title="repr(x: char): string">repr(x: char): string</a></li>
  61. <li><a class="reference" href="#repr%2Cfloat" title="repr(x: float): string">repr(x: float): string</a></li>
  62. <li><a class="reference" href="#repr%2Cint" title="repr(x: int): string">repr(x: int): string</a></li>
  63. <li><a class="reference" href="#repr%2Cint64" title="repr(x: int64): string">repr(x: int64): string</a></li>
  64. <li><a class="reference" href="#repr%2CNimNode" title="repr(x: NimNode): string">repr(x: NimNode): string</a></li>
  65. <li><a class="reference" href="#repr" title="repr(x: string | cstring): string">repr(x: string | cstring): string</a></li>
  66. <li><a class="reference" href="#repr%2Cuint64" title="repr(x: uint64): string">repr(x: uint64): string</a></li>
  67. <li><a class="reference" href="#repr%2CEnum" title="repr[Enum: enum](x: Enum): string">repr[Enum: enum](x: Enum): string</a></li>
  68. <li><a class="reference" href="#repr%2Carray%5BIDX%2CT%5D" title="repr[T, IDX](x: array[IDX, T]): string">repr[T, IDX](x: array[IDX, T]): string</a></li>
  69. <li><a class="reference" href="#repr%2CT" title="repr[T: tuple | object](x: T): string">repr[T: tuple | object](x: T): string</a></li>
  70. <li><a class="reference" href="#repr%2CopenArray%5BT%5D" title="repr[T](x: openArray[T]): string">repr[T](x: openArray[T]): string</a></li>
  71. <li><a class="reference" href="#repr_3" title="repr[T](x: ref T | ptr T): string">repr[T](x: ref T | ptr T): string</a></li>
  72. <li><a class="reference" href="#repr%2Cseq%5BT%5D" title="repr[T](x: seq[T]): string">repr[T](x: seq[T]): string</a></li>
  73. <li><a class="reference" href="#repr%2Cset%5BT%5D" title="repr[T](x: set[T]): string">repr[T](x: set[T]): string</a></li>
  74. <li><a class="reference" href="#repr%2CUncheckedArray%5BT%5D" title="repr[T](x: UncheckedArray[T]): string">repr[T](x: UncheckedArray[T]): string</a></li>
  75. </ul>
  76. <ul class="simple nested-toc-section">reprDiscriminant
  77. <li><a class="reference" href="#reprDiscriminant%2Cint" title="reprDiscriminant(e: int): string">reprDiscriminant(e: int): string</a></li>
  78. </ul>
  79. </ul>
  80. </details>
  81. </li>
  82. <li>
  83. <details open>
  84. <summary><a class="reference reference-toplevel" href="#18" id="68">Templates</a></summary>
  85. <ul class="simple simple-toc-section">
  86. <ul class="simple nested-toc-section">repr
  87. <li><a class="reference" href="#repr.t%2Ctypedesc" title="repr(t: typedesc): string">repr(t: typedesc): string</a></li>
  88. <li><a class="reference" href="#repr.t%2CT" title="repr[T: distinct | (range and not enum)](x: T): string">repr[T: distinct | (range and not enum)](x: T): string</a></li>
  89. </ul>
  90. </ul>
  91. </details>
  92. </li>
  93. </ul>
  94. </div>
  95. <div class="nine columns" id="content">
  96. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  97. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  98. <div id="tocRoot"></div>
  99. <p class="module-desc"></p>
  100. <div class="section" id="6">
  101. <h1><a class="toc-backref" href="#6">Imports</a></h1>
  102. <dl class="item">
  103. <a class="reference external" href="formatfloat.html">formatfloat</a>
  104. </dl>
  105. </div>
  106. <div class="section" id="12">
  107. <h1><a class="toc-backref" href="#12">Procs</a></h1>
  108. <dl class="item">
  109. <div id="repr-procs-all">
  110. <div id="repr,pointer">
  111. <dt><pre><span class="Keyword">proc</span> <a href="#repr%2Cpointer"><span class="Identifier">repr</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <a href="system.html#pointer"><span class="Identifier">pointer</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  112. <dd>
  113. repr of pointer as its hexadecimal value
  114. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L82" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  115. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L82" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  116. </dd>
  117. </div>
  118. <div id="repr_2">
  119. <dt><pre><span class="Keyword">proc</span> <a href="#repr_2"><span class="Identifier">repr</span></a><span class="Other">(</span><span class="Identifier">p</span><span class="Other">:</span> <span class="Keyword">proc</span> <span class="Operator">|</span> <span class="Keyword">iterator</span> {.<span class="Identifier">closure</span>.}<span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a></pre></dt>
  120. <dd>
  121. repr of a proc as its address
  122. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L98" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  123. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L98" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  124. </dd>
  125. </div>
  126. <div id="repr,bool">
  127. <dt><pre><span class="Keyword">proc</span> <a href="#repr%2Cbool"><span class="Identifier">repr</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span class="Identifier">magic</span><span class="Other">:</span> <span class="StringLit">&quot;BoolToStr&quot;</span><span class="Other">,</span> <span class="Identifier">noSideEffect</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  128. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  129. <dd>
  130. repr for a boolean argument. Returns <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt> converted to the string &quot;false&quot; or &quot;true&quot;.
  131. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L33" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  132. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L33" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  133. </dd>
  134. </div>
  135. <div id="repr,char">
  136. <dt><pre><span class="Keyword">proc</span> <a href="#repr%2Cchar"><span class="Identifier">repr</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#char"><span class="Identifier">char</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span class="Identifier">noSideEffect</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  137. <dd>
  138. <p>repr for a character argument. Returns <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt> converted to an escaped string.</p>
  139. <p><pre class="listing"><span class="Identifier">assert</span> <span class="Identifier">repr</span><span class="Punctuation">(</span><span class="Punctuation">'</span><span class="Identifier">c</span><span class="CharLit">') == &quot;'</span><span class="Identifier">c</span><span class="CharLit">'&quot;</span></pre></p>
  140. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L37" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  141. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L37" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  142. </dd>
  143. </div>
  144. <div id="repr,float">
  145. <dt><pre><span class="Keyword">proc</span> <a href="#repr%2Cfloat"><span class="Identifier">repr</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#float"><span class="Identifier">float</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  146. <dd>
  147. Same as $x
  148. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L29" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  149. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L29" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  150. </dd>
  151. </div>
  152. <div id="repr,int">
  153. <dt><pre><span class="Keyword">proc</span> <a href="#repr%2Cint"><span class="Identifier">repr</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  154. <dd>
  155. Same as $x
  156. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L17" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  157. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L17" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  158. </dd>
  159. </div>
  160. <div id="repr,int64">
  161. <dt><pre><span class="Keyword">proc</span> <a href="#repr%2Cint64"><span class="Identifier">repr</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#int64"><span class="Identifier">int64</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  162. <dd>
  163. Same as $x
  164. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L21" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  165. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L21" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  166. </dd>
  167. </div>
  168. <div id="repr,NimNode">
  169. <dt><pre><span class="Keyword">proc</span> <a href="#repr%2CNimNode"><span class="Identifier">repr</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#NimNode"><span class="Identifier">NimNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span class="Identifier">magic</span><span class="Other">:</span> <span class="StringLit">&quot;Repr&quot;</span><span class="Other">,</span> <span class="Identifier">noSideEffect</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  170. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  171. <dd>
  172. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L15" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  173. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L15" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  174. </dd>
  175. </div>
  176. <div id="repr">
  177. <dt><pre><span class="Keyword">proc</span> <a href="#repr"><span class="Identifier">repr</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> <span class="Operator">|</span> <a href="system.html#cstring"><span class="Identifier">cstring</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span class="Identifier">noSideEffect</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  178. <dd>
  179. repr for a string argument. Returns <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt> converted to a quoted and escaped string.
  180. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L54" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  181. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L54" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  182. </dd>
  183. </div>
  184. <div id="repr,uint64">
  185. <dt><pre><span class="Keyword">proc</span> <a href="#repr%2Cuint64"><span class="Identifier">repr</span></a><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#uint64"><span class="Identifier">uint64</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span class="Identifier">noSideEffect</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  186. <dd>
  187. Same as $x
  188. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L25" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  189. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L25" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  190. </dd>
  191. </div>
  192. <div id="repr,Enum">
  193. <dt><pre><span class="Keyword">proc</span> <a href="#repr%2CEnum"><span class="Identifier">repr</span></a><span class="Other">[</span><span class="Identifier">Enum</span><span class="Other">:</span> <span class="Keyword">enum</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Identifier">Enum</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span class="Identifier">magic</span><span class="Other">:</span> <span class="StringLit">&quot;EnumToStr&quot;</span><span class="Other">,</span> <span class="Identifier">noSideEffect</span><span class="Other">,</span>
  194. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  195. <dd>
  196. <p>repr for an enumeration argument. This works for any enumeration type thanks to compiler magic.</p>
  197. <p>If a <tt class="docutils literal"><span class="pre"><span class="Identifier">repr</span></span></tt> operator for a concrete enumeration is provided, this is used instead. (In other words: <em>Overwriting</em> is possible.)</p>
  198. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L70" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  199. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L70" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  200. </dd>
  201. </div>
  202. <div id="repr,array[IDX,T]">
  203. <dt><pre><span class="Keyword">proc</span> <a href="#repr%2Carray%5BIDX%2CT%5D"><span class="Identifier">repr</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">IDX</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#array"><span class="Identifier">array</span></a><span class="Other">[</span><span class="Identifier">IDX</span><span class="Other">,</span> <span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a></pre></dt>
  204. <dd>
  205. Generic <tt class="docutils literal"><span class="pre"><span class="Identifier">repr</span></span></tt> operator for arrays that is lifted from the components.
  206. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L183" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  207. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L183" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  208. </dd>
  209. </div>
  210. <div id="repr,T">
  211. <dt><pre><span class="Keyword">proc</span> <a href="#repr%2CT"><span class="Identifier">repr</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Keyword">tuple</span> <span class="Operator">|</span> <span class="Keyword">object</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span class="Identifier">noSideEffect</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  212. <dd>
  213. <p>Generic <tt class="docutils literal"><span class="pre"><span class="Identifier">repr</span></span></tt> operator for tuples that is lifted from the components of <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt>. Example:</p>
  214. <p><pre class="listing"><span class="Operator">$</span><span class="Punctuation">(</span><span class="DecNumber">23</span><span class="Punctuation">,</span> <span class="DecNumber">45</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;(23, 45)&quot;</span>
  215. <span class="Operator">$</span><span class="Punctuation">(</span><span class="Identifier">a</span><span class="Punctuation">:</span> <span class="DecNumber">23</span><span class="Punctuation">,</span> <span class="Identifier">b</span><span class="Punctuation">:</span> <span class="DecNumber">45</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;(a: 23, b: 45)&quot;</span>
  216. <span class="Operator">$</span><span class="Punctuation">(</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;()&quot;</span></pre></p>
  217. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L133" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  218. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L133" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  219. </dd>
  220. </div>
  221. <div id="repr,openArray[T]">
  222. <dt><pre><span class="Keyword">proc</span> <a href="#repr%2CopenArray%5BT%5D"><span class="Identifier">repr</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#openArray"><span class="Identifier">openArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a></pre></dt>
  223. <dd>
  224. <p>Generic <tt class="docutils literal"><span class="pre"><span class="Identifier">repr</span></span></tt> operator for openarrays that is lifted from the components of <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt>. Example:</p>
  225. <p><pre class="listing"><span class="Operator">$</span><span class="Punctuation">(</span><span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">23</span><span class="Punctuation">,</span> <span class="DecNumber">45</span><span class="Punctuation">]</span><span class="Operator">.</span><span class="Identifier">toOpenArray</span><span class="Punctuation">(</span><span class="DecNumber">0</span><span class="Punctuation">,</span> <span class="DecNumber">1</span><span class="Punctuation">)</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;[23, 45]&quot;</span></pre></p>
  226. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L187" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  227. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L187" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  228. </dd>
  229. </div>
  230. <div id="repr_3">
  231. <dt><pre><span class="Keyword">proc</span> <a href="#repr_3"><span class="Identifier">repr</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Keyword">ref</span> <span class="Identifier">T</span> <span class="Operator">|</span> <span class="Keyword">ptr</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span class="Identifier">noSideEffect</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  232. <dd>
  233. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L147" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  234. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L147" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  235. </dd>
  236. </div>
  237. <div id="repr,seq[T]">
  238. <dt><pre><span class="Keyword">proc</span> <a href="#repr%2Cseq%5BT%5D"><span class="Identifier">repr</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a></pre></dt>
  239. <dd>
  240. <p>Generic <tt class="docutils literal"><span class="pre"><span class="Identifier">repr</span></span></tt> operator for seqs that is lifted from the components of <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt>. Example:</p>
  241. <p><pre class="listing"><span class="Operator">$</span><span class="Punctuation">(</span><span class="Operator">@</span><span class="Punctuation">[</span><span class="DecNumber">23</span><span class="Punctuation">,</span> <span class="DecNumber">45</span><span class="Punctuation">]</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;@[23, 45]&quot;</span></pre></p>
  242. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L175" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  243. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L175" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  244. </dd>
  245. </div>
  246. <div id="repr,set[T]">
  247. <dt><pre><span class="Keyword">proc</span> <a href="#repr%2Cset%5BT%5D"><span class="Identifier">repr</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#set"><span class="Identifier">set</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a></pre></dt>
  248. <dd>
  249. <p>Generic <tt class="docutils literal"><span class="pre"><span class="Identifier">repr</span></span></tt> operator for sets that is lifted from the components of <tt class="docutils literal"><span class="pre"><span class="Identifier">x</span></span></tt>. Example:</p>
  250. <p><pre class="listing"><span class="Operator">$</span><span class="Punctuation">{</span><span class="DecNumber">23</span><span class="Punctuation">,</span> <span class="DecNumber">45</span><span class="Punctuation">}</span> <span class="Operator">==</span> <span class="StringLit">&quot;{23, 45}&quot;</span></pre></p>
  251. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L167" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  252. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L167" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  253. </dd>
  254. </div>
  255. <div id="repr,UncheckedArray[T]">
  256. <dt><pre><span class="Keyword">proc</span> <a href="#repr%2CUncheckedArray%5BT%5D"><span class="Identifier">repr</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <a href="system.html#UncheckedArray"><span class="Identifier">UncheckedArray</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a></pre></dt>
  257. <dd>
  258. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L195" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  259. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L195" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  260. </dd>
  261. </div>
  262. </div>
  263. <div id="reprDiscriminant-procs-all">
  264. <div id="reprDiscriminant,int">
  265. <dt><pre><span class="Keyword">proc</span> <a href="#reprDiscriminant%2Cint"><span class="Identifier">reprDiscriminant</span></a><span class="Other">(</span><span class="Identifier">e</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span class="Identifier">compilerproc</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  266. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  267. <dd>
  268. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L77" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  269. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L77" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  270. </dd>
  271. </div>
  272. </div>
  273. </dl>
  274. </div>
  275. <div class="section" id="18">
  276. <h1><a class="toc-backref" href="#18">Templates</a></h1>
  277. <dl class="item">
  278. <div id="repr-templates-all">
  279. <div id="repr.t,typedesc">
  280. <dt><pre><span class="Keyword">template</span> <a href="#repr.t%2Ctypedesc"><span class="Identifier">repr</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <a href="system.html#typedesc"><span class="Identifier">typedesc</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a></pre></dt>
  281. <dd>
  282. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L110" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  283. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L110" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  284. </dd>
  285. </div>
  286. <div id="repr.t,T">
  287. <dt><pre><span class="Keyword">template</span> <a href="#repr.t%2CT"><span class="Identifier">repr</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Keyword">distinct</span> <span class="Operator">|</span> <span class="Other">(</span><a href="system.html#range"><span class="Identifier">range</span></a> <span class="Keyword">and</span> <span class="Keyword">not</span> <span class="Keyword">enum</span><span class="Other">)</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">x</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a></pre></dt>
  288. <dd>
  289. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/system/repr_v2.nim#L102" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  290. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/system/repr_v2.nim#L102" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  291. </dd>
  292. </div>
  293. </div>
  294. </dl>
  295. </div>
  296. </div>
  297. </div>
  298. <div class="twelve-columns footer">
  299. <span class="nim-sprite"></span>
  300. <br>
  301. <small style="color: var(--hint);">Made with Nim. Generated: 2025-01-09 12:00:25 UTC</small>
  302. </div>
  303. </div>
  304. </div>
  305. <script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
  306. </body>
  307. </html>