49 lines
48 KiB
HTML
49 lines
48 KiB
HTML
|
<!doctype html>
|
|||
|
<html lang="en" dir="ltr" class="docs-wrapper plugin-docs plugin-id-default docs-version-current docs-doc-page docs-doc-id-chap-24/ce-b-system-construction-concepts" data-has-hydrated="false">
|
|||
|
<head>
|
|||
|
<meta charset="UTF-8">
|
|||
|
<meta name="generator" content="Docusaurus v3.0.1">
|
|||
|
<title data-rh="true">24.1 System Construction Concepts | Common Lisp (New) Language Reference</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:image" content="https://lisp-docs.github.io/cl-language-reference/img/1024px-Lisp_logo.svg.png"><meta data-rh="true" name="twitter:image" content="https://lisp-docs.github.io/cl-language-reference/img/1024px-Lisp_logo.svg.png"><meta data-rh="true" property="og:url" content="https://lisp-docs.github.io/cl-language-reference/chap-24/ce-b-system-construction-concepts"><meta data-rh="true" property="og:locale" content="en"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="google-site-verification" content="Vzaw013_bfdKeUVG89Ch3W1zC9_vH9ID2dPB9Dz0vr0"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="24.1 System Construction Concepts | Common Lisp (New) Language Reference"><meta data-rh="true" name="description" content="24.1.1 Loading"><meta data-rh="true" property="og:description" content="24.1.1 Loading"><link data-rh="true" rel="icon" href="../img/favicon.ico"><link data-rh="true" rel="canonical" href="ce-b-system-construction-concepts.html"><link data-rh="true" rel="alternate" href="ce-b-system-construction-concepts.html" hreflang="en"><link data-rh="true" rel="alternate" href="ce-b-system-construction-concepts.html" hreflang="x-default"><link data-rh="true" rel="preconnect" href="https://C1F2Q5VM6X-dsn.algolia.net" crossorigin="anonymous"><link rel="preconnect" href="https://www.google-analytics.com">
|
|||
|
<link rel="preconnect" href="https://www.googletagmanager.com">
|
|||
|
<script async src="https://www.googletagmanager.com/gtag/js?id=G-8TJCE4NSF8"></script>
|
|||
|
<script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","G-8TJCE4NSF8",{})</script>
|
|||
|
|
|||
|
|
|||
|
<link rel="search" type="application/opensearchdescription+xml" title="Common Lisp (New) Language Reference" href="../opensearch.xml"><link rel="stylesheet" href="../assets/css/styles.f13b59fe.css">
|
|||
|
<script src="../assets/js/runtime~main.02699c25.js" defer="defer"></script>
|
|||
|
<script src="../assets/js/main.4f0a7a76.js" defer="defer"></script>
|
|||
|
</head>
|
|||
|
<body class="navigation-with-keyboard">
|
|||
|
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){try{return new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}}()||function(){try{return localStorage.getItem("theme")}catch(t){}}();t(null!==e?e:"light")}(),function(){try{const c=new URLSearchParams(window.location.search).entries();for(var[t,e]of c)if(t.startsWith("docusaurus-data-")){var a=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(a,e)}}catch(t){}}()</script><div id="__docusaurus"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="ce-b-system-construction-concepts.html#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a href="../../index.html" target="_blank" rel="noopener noreferrer" class="navbar__brand"><div class="navbar__logo"><img src="../img/logo.svg" alt="Lisp Logo" class="themedComponent_mlkZ themedComponent--light_NVdE"><img src="../img/logo.svg" alt="Lisp Logo" class="themedComponent_mlkZ themedComponent--dark_xIcU"></div><b class="navbar__title text--truncate">Common Lisp Docs</b></a><a href="../../docs/tutorial/index.html" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Tutorial</a><a href="../index.html" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Technical Reference</a><a href="../../docs/whylisp.html" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Why Lisp?</a><a href="../../docs/howto.html" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Guides</a></div><div class="navbar__items navbar__items--right"><a href="../../docs/contribute.html" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Contribute!</a><a href="../../docs/help.html" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Getting Help</a><a href="../../docs/about.html" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">About</a><a href="../../blog.html" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">Blog</a><a href="https://github.com/lisp-docs" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link">GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a><div class="toggle_vylO colorModeToggle_DEke"><button class="clean-btn toggleButton_gllP toggleButtonDisabled_aARS" type="button" disabled="" title="Switch between dark and light mode (currently light mode)" aria-label="Switch between dark and light mode (currently light mode)" aria-live="polite"><svg viewBox="0 0 24 24" width="24" height="24" class="lightToggleIcon_pyhR"><path fill="currentColor" d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.9
|
|||
|
<!-- -->
|
|||
|
<!-- -->
|
|||
|
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="2411-loading">24.1.1 Loading<a href="ce-b-system-construction-concepts.html#2411-loading" class="hash-link" aria-label="Direct link to 24.1.1 Loading" title="Direct link to 24.1.1 Loading"></a></h2>
|
|||
|
<!-- -->
|
|||
|
<p>To <span><b>load</b></span> a <span><i>file</i></span> is to treat its contents as <span><i>code</i></span> and <span><i>execute</i></span> that <span><i>code</i></span>. The <span><i>file</i></span> may contain <span><i>source code</i></span> or <span><i>compiled code</i></span>.</p>
|
|||
|
<p>A <span><i>file</i></span> containing <span><i>source code</i></span> is called a <span><i>source file</i></span>. <em>Loading</em> a <span><i>source file</i></span> is accomplished essentially by sequentially <em>reading</em><sub>2</sub> the <span><i>forms</i></span> in the file, <em>evaluating</em> each immediately after it is <span><i>read</i></span>.</p>
|
|||
|
<p>A <span><i>file</i></span> containing <span><i>compiled code</i></span> is called a <span><i>compiled file</i></span>. <em>Loading</em> a <span><i>compiled file</i></span> is similar to <em>loading</em> a <span><i>source file</i></span>, except that the <span><i>file</i></span> does not contain text but rather an <em>implementation dependent</em> representation of pre-digested <span><i>expressions</i></span> created by the <span><i>compiler</i></span> . Often, a <span><i>compiled file</i></span> can be <em>loaded</em> more quickly than a <span><i>source file</i></span>. See Section 3.2 (Compilation).</p>
|
|||
|
<p>The way in which a <span><i>source file</i></span> is distinguished from a <span><i>compiled file</i></span> is <span><i>implementation-dependent</i></span>.</p>
|
|||
|
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="2412-features">24.1.2 Features<a href="ce-b-system-construction-concepts.html#2412-features" class="hash-link" aria-label="Direct link to 24.1.2 Features" title="Direct link to 24.1.2 Features"></a></h2>
|
|||
|
<!-- -->
|
|||
|
<p>A <span><i>feature</i></span> is an aspect or attribute of Common Lisp, of the <span><i>implementation</i></span>, or of the <span><i>environment</i></span>. A <span><i>feature</i></span> is identified by a <span><i>symbol</i></span>.</p>
|
|||
|
<p>A <span><i>feature</i></span> is said to be <span><i>present</i></span> in a <em>Lisp image</em> if and only if the <span><i>symbol</i></span> naming it is an <span><i>element</i></span> of the <span><i>list</i></span> held by the <span><i>variable</i></span> <span><b>*features*</b></span>, which is called the <span><i>features list</i></span>.</p>
|
|||
|
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="24121-feature-expressions">24.1.2.1 Feature Expressions<a href="ce-b-system-construction-concepts.html#24121-feature-expressions" class="hash-link" aria-label="Direct link to 24.1.2.1 Feature Expressions" title="Direct link to 24.1.2.1 Feature Expressions"></a></h3>
|
|||
|
<!-- -->
|
|||
|
<p>Boolean combinations of <span><i>features</i></span>, called <span><i>feature expressions</i></span>, are used by the #+ and #- <span><i>reader macros</i></span> in order to direct conditional <em>reading</em> of <span><i>expressions</i></span> by the <em>Lisp reader</em> .</p>
|
|||
|
<p>The rules for interpreting a <span><i>feature expression</i></span> are as follows:</p>
|
|||
|
<span><i>feature</i></span>
|
|||
|
<p>If a <span><i>symbol</i></span> naming a <span><i>feature</i></span> is used as a <span><i>feature expression</i></span>, the <span><i>feature expression</i></span> succeeds if that <span><i>feature</i></span> is <span><i>present</i></span>; otherwise it fails.</p>
|
|||
|
<p>(not <em>feature-conditional</em>)</p>
|
|||
|
<p>A <span><b>not</b></span> <span><i>feature expression</i></span> succeeds if its argument <em>feature-conditional</em> fails; otherwise, it succeeds.</p>
|
|||
|
<p>(and <em>{feature-conditional}</em>*)</p>
|
|||
|
<p>An <span><b>and</b></span> <span><i>feature expression</i></span> succeeds if all of its argument <em>feature-conditionals</em> succeed; otherwise, it fails.</p>
|
|||
|
<p>System</p>
|
|||
|
<p>(or <em>{feature-conditional}</em>*)</p>
|
|||
|
<p>An <span><b>or</b></span> <span><i>feature expression</i></span> succeeds if any of its argument <em>feature-conditionals</em> succeed; otherwise, it fails.</p>
|
|||
|
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="241211-examples-of-feature-expressions">24.1.2.1.1 Examples of Feature Expressions<a href="ce-b-system-construction-concepts.html#241211-examples-of-feature-expressions" class="hash-link" aria-label="Direct link to 24.1.2.1.1 Examples of Feature Expressions" title="Direct link to 24.1.2.1.1 Examples of Feature Expressions"></a></h4>
|
|||
|
<!-- -->
|
|||
|
<!-- -->
|
|||
|
<p>For example, suppose that in <span><i>implementation</i></span> A, the <span><i>features</i></span> spice and perq are <span><i>present</i></span>, but the <span><i>feature</i></span> lispm is not <span><i>present</i></span>; in <span><i>implementation</i></span> B, the feature lispm is <span><i>present</i></span>, but the <span><i>features</i></span> spice and perq are not <span><i>present</i></span>; and in <span><i>implementation</i></span> C, none of the features spice, <em>lispm</em>, or perq are <span><i>present</i></span>. Figure 24–1 shows some sample <span><i>expressions</i></span>, and how they would be <span><i>read</i></span> <sub>2</sub> in these <span><i>implementations</i></span>.</p>
|
|||
|
<div class="language-lisp codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockTitle_Ktv7">Figure 24–1. Features examples</div><div class="codeBlockContent_biex"><pre tabindex="0" class="prism-code language-lisp codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><span class="token-line" style="color:#393A34"><span class="token plain"><p></span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">cons</span><span class="token plain"> #+spice </span><span class="token string" style="color:#e3116c">"Spice"</span><span class="token plain"> #-spice </span><span class="token string" style="color:#e3116c">"Lispm"</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </p><p>in *implementation* A *. </span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain"> .* </span><span class="token punctuation" style="color:#393A34">(</span><span class="token car">CONS</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Spice"</span><span class="token plain"> X</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </p><p>in *implementation* B *. </span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain"> .* </span><span class="token punctuation" style="color:#393A34">(</span><span class="token car">CONS</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Lispm"</span><span class="token plain"> X</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </p><p>in *implementation* C *. </span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain"> .* </span><span class="token punctuation" style="color:#393A34">(</span><span class="token car">CONS</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Lispm"</span><span class="token plain"> X</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </p><p></span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">cons</span><span class="token plain"> #+spice </span><span class="token string" style="color:#e3116c">"Spice"</span><span class="token plain"> #+LispM </span><span class="token string" style="color:#e3116c">"Lispm"</span><span class="token plain"> x</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </p><p>in *implementation* A *. </span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain"> .* </span><span class="token punctuation" style="color:#393A34">(</span><span class="token car">CONS</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Spice"</span><span class="token plain"> X</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </p><p>in *implementation* B *. </span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain"> .* </span><span class="token punctuation" style="color:#393A34">(</span><span class="token car">CONS</span><span class="token plain"> </span><span class="token string" style="color:#e3116c">"Lispm"</span><span class="token plain"> X</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </p><p>in *implementation* C *. </span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain"> .* </span><span class="token punctuation" style="color:#393A34">(</span><span class="token car">C
|
|||
|
</body>
|
|||
|
</html>
|