ocaml-trace/ppxlib/Ppxlib/Expansion_helpers/Quoter/index.html
2024-03-08 16:51:12 +00:00

8 lines
No EOL
3.2 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>Quoter (ppxlib.Ppxlib.Expansion_helpers.Quoter)</title><link rel="stylesheet" href="../../../../_odoc-theme/odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 2.2.2"/><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">ppxlib</a> &#x00BB; <a href="../../index.html">Ppxlib</a> &#x00BB; <a href="../index.html">Expansion_helpers</a> &#x00BB; Quoter</nav><header class="odoc-preamble"><h1>Module <code><span>Expansion_helpers.Quoter</span></code></h1><p>Generate expressions in a hygienic way.</p><p>The idea is that whenever we want to refer to an expression in generated code we first quote it. The result will be an identifier that is guaranteed to refer to the expression it was created from. This way it is impossible for quoted fragments to refer to newly introduced expressions.</p><p>For more information, see the <a href="../../../good-practices.html#quoting">section on quoting</a> in the good practices section.</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><div class="odoc-spec"><div class="spec value anchored" id="val-create"><a href="#val-create" class="anchor"></a><code><span><span class="keyword">val</span> create : <span>unit <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>Creates a quoter. A quoter guarantees to give names that do not clash with any other names used before</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-quote"><a href="#val-quote" class="anchor"></a><code><span><span class="keyword">val</span> quote :
<span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span>
<span><a href="../../../Astlib/Ast_500/Parsetree/index.html#type-expression">Astlib.Ast_500.Parsetree.expression</a> <span class="arrow">&#45;&gt;</span></span>
<a href="../../../Astlib/Ast_500/Parsetree/index.html#type-expression">Astlib.Ast_500.Parsetree.expression</a></span></code></div><div class="spec-doc"><p><code>quote t e</code> returns the expression that is safe to use in place of <code>e</code> in generated code</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-sanitize"><a href="#val-sanitize" class="anchor"></a><code><span><span class="keyword">val</span> sanitize :
<span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span>
<span><a href="../../../Astlib/Ast_500/Parsetree/index.html#type-expression">Astlib.Ast_500.Parsetree.expression</a> <span class="arrow">&#45;&gt;</span></span>
<a href="../../../Astlib/Ast_500/Parsetree/index.html#type-expression">Astlib.Ast_500.Parsetree.expression</a></span></code></div><div class="spec-doc"><p><code>sanitize t e</code> Returns <code>e</code> wrapped with bindings for all quoted expressions in the quoter <code>t</code></p></div></div></div></body></html>