mirror of
https://github.com/c-cube/sidekick.git
synced 2025-12-07 11:45:41 -05:00
2 lines
No EOL
7.6 KiB
HTML
2 lines
No EOL
7.6 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Sidekick_base__ID (sidekick-base.Sidekick_base__ID)</title><link rel="stylesheet" href="../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.3"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> – <a href="../index.html">sidekick-base</a> » Sidekick_base__ID</nav><h1>Module <code>Sidekick_base__ID</code></h1><p>Unique Identifiers</p></header><aside><p>We use generative identifiers everywhere in <code>Sidekick_base</code>. Unlike strings, there are no risk of collision: during parsing, a new declaration or definition should create a fresh <code>ID.t</code> and associate it with the string name, and later references should look into some hashtable or map to get the ID corresponding to a string.</p><p>This allows us to handle definition shadowing or binder shadowing easily.</p></aside><dl><dt class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><code><span class="keyword">type</span> t</code></dt><dd><p>The opaque type of unique identifiers</p></dd></dl><dl><dt class="spec value" id="val-make"><a href="#val-make" class="anchor"></a><code><span class="keyword">val</span> make : string <span>-></span> <a href="index.html#type-t">t</a></code></dt><dd><p><code>make s</code> creates a new identifier with name <code>s</code> and some internal information. It is different than any other identifier created before or after, even with the same name.</p></dd></dl><dl><dt class="spec value" id="val-makef"><a href="#val-makef" class="anchor"></a><code><span class="keyword">val</span> makef : <span><span>(<span class="type-var">'a</span>, Stdlib.Format.formatter, unit, <a href="index.html#type-t">t</a>)</span> Stdlib.format4</span> <span>-></span> <span class="type-var">'a</span></code></dt><dd><p><code>makef "foo %d bar %b" 42 true</code> is like <code>make (Format.asprintf "foo %d bar %b" 42 true)</code>.</p></dd></dl><dl><dt class="spec value" id="val-copy"><a href="#val-copy" class="anchor"></a><code><span class="keyword">val</span> copy : <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-t">t</a></code></dt><dd><p>Fresh copy of the identifier, distinct from it, but with the same name.</p></dd></dl><dl><dt class="spec value" id="val-id"><a href="#val-id" class="anchor"></a><code><span class="keyword">val</span> id : <a href="index.html#type-t">t</a> <span>-></span> int</code></dt><dd><p>Unique integer counter for this identifier.</p></dd></dl><dl><dt class="spec value" id="val-to_string"><a href="#val-to_string" class="anchor"></a><code><span class="keyword">val</span> to_string : <a href="index.html#type-t">t</a> <span>-></span> string</code></dt><dd><p>Print identifier.</p></dd></dl><dl><dt class="spec value" id="val-to_string_full"><a href="#val-to_string_full" class="anchor"></a><code><span class="keyword">val</span> to_string_full : <a href="index.html#type-t">t</a> <span>-></span> string</code></dt><dd><p>Printer name and unique counter for this ID.</p></dd></dl><div><div class="spec include"><div class="doc"><details open="open"><summary><span class="def"><code><span class="keyword">include</span> <a href="../../sidekick/Sidekick_sigs/index.html#module-type-EQ">Sidekick_util.Intf.EQ</a> <span class="keyword">with</span> <span class="keyword">type</span> <a href="../../sidekick/Sidekick_sigs/module-type-EQ/index.html#type-t">t</a> := <a href="index.html#type-t">t</a></code></span></summary><dl><dt class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><code><span class="keyword">type</span> t</code></dt></dl><dl><dt class="spec value" id="val-equal"><a href="#val-equal" class="anchor"></a><code><span class="keyword">val</span> equal : <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-t">t</a> <span>-></span> bool</code></dt></dl></details></div></div></div><div><div class="spec include"><div class="doc"><details open="open"><summary><span class="def"><code><span class="keyword">include</span> <a href="../../sidekick/Sidekick_sigs/index.html#module-type-ORD">Sidekick_util.Intf.ORD</a> <span class="keyword">with</span> <span class="keyword">type</span> <a href="../../sidekick/Sidekick_sigs/module-type-ORD/index.html#type-t">t</a> := <a href="index.html#type-t">t</a></code></span></summary><dl><dt class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><code><span class="keyword">type</span> t</code></dt></dl><dl><dt class="spec value" id="val-compare"><a href="#val-compare" class="anchor"></a><code><span class="keyword">val</span> compare : <a href="index.html#type-t">t</a> <span>-></span> <a href="index.html#type-t">t</a> <span>-></span> int</code></dt></dl></details></div></div></div><div><div class="spec include"><div class="doc"><details open="open"><summary><span class="def"><code><span class="keyword">include</span> <a href="../../sidekick/Sidekick_sigs/index.html#module-type-HASH">Sidekick_util.Intf.HASH</a> <span class="keyword">with</span> <span class="keyword">type</span> <a href="../../sidekick/Sidekick_sigs/module-type-HASH/index.html#type-t">t</a> := <a href="index.html#type-t">t</a></code></span></summary><dl><dt class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><code><span class="keyword">type</span> t</code></dt></dl><dl><dt class="spec value" id="val-hash"><a href="#val-hash" class="anchor"></a><code><span class="keyword">val</span> hash : <a href="index.html#type-t">t</a> <span>-></span> int</code></dt></dl></details></div></div></div><div><div class="spec include"><div class="doc"><details open="open"><summary><span class="def"><code><span class="keyword">include</span> <a href="../../sidekick/Sidekick_sigs/index.html#module-type-PRINT">Sidekick_util.Intf.PRINT</a> <span class="keyword">with</span> <span class="keyword">type</span> <a href="../../sidekick/Sidekick_sigs/module-type-PRINT/index.html#type-t">t</a> := <a href="index.html#type-t">t</a></code></span></summary><dl><dt class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><code><span class="keyword">type</span> t</code></dt></dl><dl><dt class="spec value" id="val-pp"><a href="#val-pp" class="anchor"></a><code><span class="keyword">val</span> pp : <span><a href="index.html#type-t">t</a> CCFormat.printer</span></code></dt></dl></details></div></div></div><dl><dt class="spec value" id="val-pp_name"><a href="#val-pp_name" class="anchor"></a><code><span class="keyword">val</span> pp_name : <span><a href="index.html#type-t">t</a> CCFormat.printer</span></code></dt></dl><div class="spec module" id="module-Map"><a href="#module-Map" class="anchor"></a><code><span class="keyword">module</span> Map : CCMap.S <span class="keyword">with</span> <span class="keyword">type</span> <a href="index.html#module-Map">Map</a>.key = <a href="index.html#type-t">t</a></code></div><div class="spec module" id="module-Set"><a href="#module-Set" class="anchor"></a><code><span class="keyword">module</span> Set : CCSet.S <span class="keyword">with</span> <span class="keyword">type</span> <a href="index.html#module-Set">Set</a>.elt = <a href="index.html#type-t">t</a></code></div><div class="spec module" id="module-Tbl"><a href="#module-Tbl" class="anchor"></a><code><span class="keyword">module</span> Tbl : CCHashtbl.S <span class="keyword">with</span> <span class="keyword">type</span> <a href="index.html#module-Tbl">Tbl</a>.key = <a href="index.html#type-t">t</a></code></div></div></body></html> |