166 lines
9.2 KiB
HTML
166 lines
9.2 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<!-- Created by GNU Texinfo 6.8, https://www.gnu.org/software/texinfo/ -->
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<!-- This manual describes ASDF, a system definition facility
|
|
for Common Lisp programs and libraries.
|
|
|
|
You can find the latest version of this manual at
|
|
https://common-lisp.net/project/asdf/asdf.html.
|
|
|
|
ASDF Copyright (C) 2001-2019 Daniel Barlow and contributors.
|
|
|
|
This manual Copyright (C) 2001-2019 Daniel Barlow and contributors.
|
|
|
|
This manual revised (C) 2009-2019 Robert P. Goldman and Francois-Rene Rideau.
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
a copy of this software and associated documentation files (the
|
|
"Software"), to deal in the Software without restriction, including
|
|
without limitation the rights to use, copy, modify, merge, publish,
|
|
distribute, sublicense, and/or sell copies of the Software, and to
|
|
permit persons to whom the Software is furnished to do so, subject to
|
|
the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be
|
|
included in all copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
-->
|
|
<title>How do I work with readtables? (ASDF Manual)</title>
|
|
|
|
<meta name="description" content="How do I work with readtables? (ASDF Manual)">
|
|
<meta name="keywords" content="How do I work with readtables? (ASDF Manual)">
|
|
<meta name="resource-type" content="document">
|
|
<meta name="distribution" content="global">
|
|
<meta name="Generator" content="makeinfo">
|
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
|
|
<link href="index.html" rel="start" title="Top">
|
|
<link href="Concept-Index.html" rel="index" title="Concept Index">
|
|
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
|
<link href="Issues-with-using-and-extending-ASDF-to-define-systems.html" rel="up" title="Issues with using and extending ASDF to define systems">
|
|
<link href="How-can-I-capture-ASDF_0027s-output_003f.html" rel="next" title="How can I capture ASDF's output?">
|
|
<link href="How-do-I-mark-a-source-file-to-be-loaded-only-and-not-compiled_003f.html" rel="prev" title="How do I mark a source file to be loaded only and not compiled?">
|
|
<style type="text/css">
|
|
<!--
|
|
a.copiable-anchor {visibility: hidden; text-decoration: none; line-height: 0em}
|
|
a.summary-letter {text-decoration: none}
|
|
blockquote.indentedblock {margin-right: 0em}
|
|
div.display {margin-left: 3.2em}
|
|
div.example {margin-left: 3.2em}
|
|
kbd {font-style: oblique}
|
|
pre.display {font-family: inherit}
|
|
pre.format {font-family: inherit}
|
|
pre.menu-comment {font-family: serif}
|
|
pre.menu-preformatted {font-family: serif}
|
|
span.nolinebreak {white-space: nowrap}
|
|
span.roman {font-family: initial; font-weight: normal}
|
|
span.sansserif {font-family: sans-serif; font-weight: normal}
|
|
span:hover a.copiable-anchor {visibility: visible}
|
|
ul.no-bullet {list-style: none}
|
|
-->
|
|
</style>
|
|
|
|
|
|
</head>
|
|
|
|
<body lang="en">
|
|
<div class="subsection" id="How-do-I-work-with-readtables_003f">
|
|
<div class="header">
|
|
<p>
|
|
Next: <a href="How-can-I-capture-ASDF_0027s-output_003f.html" accesskey="n" rel="next">How can I capture ASDF’s output?</a>, Previous: <a href="How-do-I-mark-a-source-file-to-be-loaded-only-and-not-compiled_003f.html" accesskey="p" rel="prev">How do I mark a source file to be loaded only and not compiled?</a>, Up: <a href="Issues-with-using-and-extending-ASDF-to-define-systems.html" accesskey="u" rel="up">Issues with using and extending ASDF to define systems</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
<hr>
|
|
<span id="How-do-I-work-with-readtables_003f-1"></span><h4 class="subsection">13.6.7 How do I work with readtables?</h4>
|
|
|
|
<span id="index-readtables"></span>
|
|
|
|
<p>It is possible to configure the lisp syntax by modifying the currently-active readtable.
|
|
However, this same readtable is shared globally by all software being compiled by ASDF,
|
|
especially since <code>load</code> and <code>compile-file</code> both bind <var>*readtable*</var>,
|
|
so that its value is the same across the build at the start of every file
|
|
(unless overridden by some <code>perform :around</code> method),
|
|
even if a file locally binds it to a different readtable during the build.
|
|
</p>
|
|
<p>Therefore, the following hygiene restrictions apply. If you don’t abide by these restrictions,
|
|
there will be situations where your output files will be corrupted during an incremental build.
|
|
We are not trying to prescribe new restrictions for the sake of good style:
|
|
these restrictions have always applied implicitly, and
|
|
we are simply describing what they have always been.
|
|
</p>
|
|
<ul>
|
|
<li> It is forbidden to modifying any standard character or standard macro dispatch defined in the CLHS.
|
|
</li><li> No two dependencies may assign different meanings to the same non-standard character.
|
|
</li><li> Using any non-standard character while expecting the implementation to treat some way
|
|
counts as such an assignment of meaning.
|
|
</li><li> libraries need to document these assignments of meaning to non-standard characters.
|
|
</li><li> free software libraries will register these changes on:
|
|
<a href="http://www.cliki.net/Macro%20Characters">http://www.cliki.net/Macro%20Characters</a>
|
|
</li></ul>
|
|
|
|
<p>If you want to use readtable modifications that cannot abide by those restrictions,
|
|
you <em>must</em> create a different readtable object and set <var>*readtable*</var>
|
|
to temporarily bind it to your new readtable (which will be undone after processing the file).
|
|
</p>
|
|
<p>For that, we recommend you use system <code>named-readtables</code>
|
|
to define or combine such readtables using <code>named-readtables:defreadtable</code>
|
|
and use them using <code>named-readtables:in-readtable</code>.
|
|
Equivalently, you can use system <code>cl-syntax</code>,
|
|
that itself uses <code>named-readtables</code>,
|
|
but may someday do more with, e.g. <var>*print-pprint-dispatch*</var>.
|
|
</p>
|
|
<p>For even more advanced syntax modification beyond what a readtable can express,
|
|
you may consider either:
|
|
</p><ul>
|
|
<li> a <code>perform</code> method that compiles a constant file that contains a single form
|
|
<code>#.*code-read-with-alternate-reader*</code> in an environment where this special variable
|
|
was bound to the code read by your alternate reader, or
|
|
</li><li> using the system <code>reader-interception</code>.
|
|
</li></ul>
|
|
|
|
<p>Beware that it is unsafe to use ASDF from the REPL to compile or load systems
|
|
while the readtable isn’t the shared readtable previously used to build software.
|
|
You <em>must</em> manually undo any binding of <var>*readtable*</var> at the REPL
|
|
and restore its initial value whenever you call <code>operate</code>
|
|
(via e.g. <code>load-system</code>, <code>test-system</code> or <code>require</code>)
|
|
from a REPL that is using a different readtable.
|
|
</p>
|
|
<ul class="section-toc">
|
|
<li><a href="How-do-I-work-with-readtables_003f.html#How-should-my-system-use-a-readtable-exported-by-another-system_003f" accesskey="1">How should my system use a readtable exported by another system?</a></li>
|
|
<li><a href="How-do-I-work-with-readtables_003f.html#How-should-my-library-make-a-readtable-available-to-other-systems_003f" accesskey="2">How should my library make a readtable available to other systems?</a></li>
|
|
</ul>
|
|
<div class="subsubsection" id="How-should-my-system-use-a-readtable-exported-by-another-system_003f">
|
|
<h4 class="subsubsection">13.6.7.1 How should my system use a readtable exported by another system?</h4>
|
|
|
|
<p>Use from the <code>named-readtables</code> system the macro <code>named-readtables:in-readtable</code>.
|
|
</p>
|
|
<p>If the other system fails to use <code>named-readtables</code>, fix it and send a patch upstream.
|
|
In the day and age of Quicklisp and clbuild, there is little reason
|
|
to eschew using such an important library anymore.
|
|
</p>
|
|
</div>
|
|
<div class="subsubsection" id="How-should-my-library-make-a-readtable-available-to-other-systems_003f">
|
|
<h4 class="subsubsection">13.6.7.2 How should my library make a readtable available to other systems?</h4>
|
|
|
|
<p>Use from the <code>named-readtables</code> system the macro <code>named-readtables:defreadtable</code>.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<hr>
|
|
<div class="header">
|
|
<p>
|
|
Next: <a href="How-can-I-capture-ASDF_0027s-output_003f.html">How can I capture ASDF’s output?</a>, Previous: <a href="How-do-I-mark-a-source-file-to-be-loaded-only-and-not-compiled_003f.html">How do I mark a source file to be loaded only and not compiled?</a>, Up: <a href="Issues-with-using-and-extending-ASDF-to-define-systems.html">Issues with using and extending ASDF to define systems</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|