moonpool/dev/ocaml/Freshening/index.html

22 lines
No EOL
14 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Freshening (ocaml.Freshening)</title><link rel="stylesheet" href="../../_odoc-theme/odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 2.2.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> <a href="../index.html">ocaml</a> &#x00BB; Freshening</nav><header class="odoc-preamble"><h1>Module <code><span>Freshening</span></code></h1><p>Freshening of various identifiers.</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec type anchored" id="type-t"><a href="#type-t" class="anchor"></a><code><span><span class="keyword">type</span> t</span></code></div><div class="spec-doc"><p>A table used for freshening variables and static exception identifiers.</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-subst"><a href="#type-subst" class="anchor"></a><code><span><span class="keyword">type</span> subst</span><span> = <a href="#type-t">t</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-empty"><a href="#val-empty" class="anchor"></a><code><span><span class="keyword">val</span> empty : <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>The freshening that does nothing. This is the unique inactive freshening.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-is_empty"><a href="#val-is_empty" class="anchor"></a><code><span><span class="keyword">val</span> is_empty : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-activate"><a href="#val-activate" class="anchor"></a><code><span><span class="keyword">val</span> activate : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Activate the freshening. Without activation, operations to request freshenings have no effect (cf. the documentation below for <code>add_variable</code>). As such, the inactive renaming is unique.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-empty_preserving_activation_state"><a href="#val-empty_preserving_activation_state" class="anchor"></a><code><span><span class="keyword">val</span> empty_preserving_activation_state : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Given the inactive freshening, return the same; otherwise, return an empty active freshening.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_variable"><a href="#val-add_variable" class="anchor"></a><code><span><span class="keyword">val</span> add_variable : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Variable/index.html#type-t">Variable.t</a> <span class="arrow">&#45;&gt;</span></span> <a href="../Variable/index.html#type-t">Variable.t</a> * <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p><code>add_variable t var</code> If <code>t</code> is active: It returns a fresh variable <code>new_var</code> and adds <code>var</code> -&gt; <code>new_var</code> to the freshening. If a renaming <code>other_var</code> -&gt; <code>var</code> or <code>symbol</code> -&gt; <code>var</code> was already present in <code>t</code>, it will also add <code>other_var</code> -&gt; <code>new_var</code> and <code>symbol</code> -&gt; <code>new_var</code>. If <code>t</code> is inactive, this is the identity.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_variables'"><a href="#val-add_variables'" class="anchor"></a><code><span><span class="keyword">val</span> add_variables' : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span><a href="../Variable/index.html#type-t">Variable.t</a> list</span> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Variable/index.html#type-t">Variable.t</a> list</span> * <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Like <code>add_variable</code>, but for multiple variables, each freshened separately.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_variables"><a href="#val-add_variables" class="anchor"></a><code><span><span class="keyword">val</span> add_variables : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span><span>(<a href="../Variable/index.html#type-t">Variable.t</a> * <span class="type-var">'a</span>)</span> list</span> <span class="arrow">&#45;&gt;</span></span> <span><span>(<a href="../Variable/index.html#type-t">Variable.t</a> * <span class="type-var">'a</span>)</span> list</span> * <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Like <code>add_variables'</code>, but passes through the second component of the input list unchanged.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_mutable_variable"><a href="#val-add_mutable_variable" class="anchor"></a><code><span><span class="keyword">val</span> add_mutable_variable : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Mutable_variable/index.html#type-t">Mutable_variable.t</a> <span class="arrow">&#45;&gt;</span></span> <a href="../Mutable_variable/index.html#type-t">Mutable_variable.t</a> * <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Like <code>add_variable</code>, but for mutable variables.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_static_exception"><a href="#val-add_static_exception" class="anchor"></a><code><span><span class="keyword">val</span> add_static_exception : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Static_exception/index.html#type-t">Static_exception.t</a> <span class="arrow">&#45;&gt;</span></span> <a href="../Static_exception/index.html#type-t">Static_exception.t</a> * <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>As for <code>add_variable</code>, but for static exception identifiers.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-apply_variable"><a href="#val-apply_variable" class="anchor"></a><code><span><span class="keyword">val</span> apply_variable : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Variable/index.html#type-t">Variable.t</a> <span class="arrow">&#45;&gt;</span></span> <a href="../Variable/index.html#type-t">Variable.t</a></span></code></div><div class="spec-doc"><p><code>apply_variable t var</code> applies the freshening <code>t</code> to <code>var</code>. If no renaming is specified in <code>t</code> for <code>var</code> it is returned unchanged.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-apply_mutable_variable"><a href="#val-apply_mutable_variable" class="anchor"></a><code><span><span class="keyword">val</span> apply_mutable_variable : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Mutable_variable/index.html#type-t">Mutable_variable.t</a> <span class="arrow">&#45;&gt;</span></span> <a href="../Mutable_variable/index.html#type-t">Mutable_variable.t</a></span></code></div><div class="spec-doc"><p>As for <code>apply_variable</code>, but for mutable variables.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-apply_static_exception"><a href="#val-apply_static_exception" class="anchor"></a><code><span><span class="keyword">val</span> apply_static_exception : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Static_exception/index.html#type-t">Static_exception.t</a> <span class="arrow">&#45;&gt;</span></span> <a href="../Static_exception/index.html#type-t">Static_exception.t</a></span></code></div><div class="spec-doc"><p>As for <code>apply_variable</code>, but for static exception identifiers.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-rewrite_recursive_calls_with_symbols"><a href="#val-rewrite_recursive_calls_with_symbols" class="anchor"></a><code><span><span class="keyword">val</span> rewrite_recursive_calls_with_symbols :
<span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span>
<span><a href="../Flambda/index.html#type-function_declarations">Flambda.function_declarations</a> <span class="arrow">&#45;&gt;</span></span>
<span>make_closure_symbol:<span>(<span><a href="../Closure_id/index.html#type-t">Closure_id.t</a> <span class="arrow">&#45;&gt;</span></span> <a href="../Symbol/index.html#type-t">Symbol.t</a>)</span> <span class="arrow">&#45;&gt;</span></span>
<a href="../Flambda/index.html#type-function_declarations">Flambda.function_declarations</a></span></code></div><div class="spec-doc"><p>Replace recursive accesses to the closures in the set through <code>Symbol</code> by the corresponding <code>Var</code>. This is used to recover the recursive call when importing code from another compilation unit.</p><p>If the renaming is inactive, this is the identity.</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-Project_var"><a href="#module-Project_var" class="anchor"></a><code><span><span class="keyword">module</span> <a href="Project_var/index.html">Project_var</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-apply_function_decls_and_free_vars"><a href="#val-apply_function_decls_and_free_vars" class="anchor"></a><code><span><span class="keyword">val</span> apply_function_decls_and_free_vars :
<span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span>
<span><span><span>(<a href="../Flambda/index.html#type-specialised_to">Flambda.specialised_to</a> * <span class="type-var">'a</span>)</span> <a href="../Variable/Map/index.html#type-t">Variable.Map.t</a></span> <span class="arrow">&#45;&gt;</span></span>
<span><a href="../Flambda/index.html#type-function_declarations">Flambda.function_declarations</a> <span class="arrow">&#45;&gt;</span></span>
<span>only_freshen_parameters:bool <span class="arrow">&#45;&gt;</span></span>
<span><span>(<a href="../Flambda/index.html#type-specialised_to">Flambda.specialised_to</a> * <span class="type-var">'a</span>)</span> <a href="../Variable/Map/index.html#type-t">Variable.Map.t</a></span>
* <a href="../Flambda/index.html#type-function_declarations">Flambda.function_declarations</a>
* <a href="#type-t">t</a>
* <a href="Project_var/index.html#type-t">Project_var.t</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-does_not_freshen"><a href="#val-does_not_freshen" class="anchor"></a><code><span><span class="keyword">val</span> does_not_freshen : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><span><a href="../Variable/index.html#type-t">Variable.t</a> list</span> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-print"><a href="#val-print" class="anchor"></a><code><span><span class="keyword">val</span> print : <span><a href="../Stdlib/Format/index.html#type-formatter">Stdlib.Format.formatter</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-freshen_projection_relation"><a href="#val-freshen_projection_relation" class="anchor"></a><code><span><span class="keyword">val</span> freshen_projection_relation :
<span><span><a href="../Flambda/index.html#type-specialised_to">Flambda.specialised_to</a> <a href="../Variable/Map/index.html#type-t">Variable.Map.t</a></span> <span class="arrow">&#45;&gt;</span></span>
<span>freshening:<a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span>
<span>closure_freshening:<a href="Project_var/index.html#type-t">Project_var.t</a> <span class="arrow">&#45;&gt;</span></span>
<span><a href="../Flambda/index.html#type-specialised_to">Flambda.specialised_to</a> <a href="../Variable/Map/index.html#type-t">Variable.Map.t</a></span></span></code></div><div class="spec-doc"><p>N.B. This does not freshen the domain of the supplied map, only the range.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-freshen_projection_relation'"><a href="#val-freshen_projection_relation'" class="anchor"></a><code><span><span class="keyword">val</span> freshen_projection_relation' :
<span><span><span>(<a href="../Flambda/index.html#type-specialised_to">Flambda.specialised_to</a> * <span class="type-var">'a</span>)</span> <a href="../Variable/Map/index.html#type-t">Variable.Map.t</a></span> <span class="arrow">&#45;&gt;</span></span>
<span>freshening:<a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span>
<span>closure_freshening:<a href="Project_var/index.html#type-t">Project_var.t</a> <span class="arrow">&#45;&gt;</span></span>
<span><span>(<a href="../Flambda/index.html#type-specialised_to">Flambda.specialised_to</a> * <span class="type-var">'a</span>)</span> <a href="../Variable/Map/index.html#type-t">Variable.Map.t</a></span></span></code></div></div></div></body></html>