1
0
Fork 0
cl-sites/novaspec.org/cl/f_export.html
2025-02-05 18:52:26 +01:00

520 lines
No EOL
11 KiB
HTML

<!DOCTYPE HTML>
<HTML LANG="en-us"
><HEAD
><TITLE
>export | Common Lisp Nova Spec</TITLE
><META CHARSET="US-ASCII"
><LINK REL="canonical" HREF="f_export.html"
><LINK REL="next" HREF="f_find-symbol.html" TYPE="text/html" TITLE="find-symbol"
><LINK REL="prev" HREF="t_package.html" TYPE="text/html" TITLE="package"
><LINK REL="up" HREF="11_2_Packages_Dictionary.html" TYPE="text/html" TITLE="11.2 Packages Dictionary"
><LINK REL="start" HREF="index.html" TYPE="text/html" TITLE="Common Lisp Nova Spec"
><META NAME="VIEWPORT" CONTENT="width=device-width, initial-scale=1.0"
><LINK REL="STYLESHEET" HREF="dpans.css%3F3909942064.css"
><SCRIPT SRC="dpans.js%3F3909942064"
></SCRIPT
><SCRIPT SRC="apropos.js%3F3909942064"
></SCRIPT
></HEAD
><BODY
><DIV
><DIV CLASS="topnav"
><DIV CLASS="breadcrumb"
><SPAN CLASS="breadcrumb-item"
><A HREF="index.html"
>Common Lisp Nova Spec</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="11_Packages.html"
>11. Packages</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="11_2_Packages_Dictionary.html"
>11.2 Packages Dictionary</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="f_export.html"
>export</A
></SPAN
></DIV
><DIV CLASS="apropos"
><DIV CLASS="apropos-io"
><A HREF="t_package.html" CLASS="prev"
>&#8592;</A
><SPAN ID="apropos-label"
>Apropos </SPAN
><INPUT ID="apropos" AUTOFOCUS="AUTOFOCUS" PLACEHOLDER="Type here to search" ONINPUT="aproposInput(this);" ONKEYUP="aproposKeyup(event);" ONCHANGE="aproposChange(this);" ONFOCUS="aproposFocus(this);" ONFOCUSOUT="aproposFocusout(this);"
><A HREF="f_find-symbol.html" CLASS="next"
>&#8594;</A
></DIV
><DIV ID="apropos-res"
></DIV
></DIV
></DIV
><DIV CLASS="matter"
><DIV CLASS="com"
><DIV CLASS="begincom"
><HR
><TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0"
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" WIDTH="100%" CLASS="name"
><SPAN CLASS="idx" DATA-KIND="idxref" DATA-TERM="export"
></SPAN
><B
>export</B
></TD
><TD ALIGN="RIGHT" VALIGN="BASELINE" WIDTH="0" NOWRAP="NOWRAP" CLASS="ftype"
><I
>Function</I
></TD
></TR
></TABLE
><HR
></DIV
><UL CLASS="subtoc"
></UL
><DL
><DT
><B
>Syntax</B
></DT
><DD
><P CLASS="j"
><B
>export</B
> <SPAN CLASS="cmssi"
>symbols</SPAN
> <SPAN CLASS="cmtt"
>&amp;optional</SPAN
> <SPAN CLASS="cmssi"
>package</SPAN
> <SPAN CLASS="arrow"
>&#8594;</SPAN
> <SPAN CLASS="misc"
><B
>t</B
></SPAN
></P
></DD
><DT
><B
>Arguments and Values</B
></DT
><DD
><P CLASS="j"
><VAR CLASS="param"
>symbols</VAR
> &#8212; a <A HREF="26_1_Glossary.html#designator"
><EM CLASS="term"
>designator</EM
></A
> for a <A HREF="26_1_Glossary.html#list"
><EM CLASS="term"
>list</EM
></A
> of <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbols</EM
></A
>. </P
><P CLASS="j"
><VAR CLASS="param"
>package</VAR
> &#8212; a <A HREF="26_1_Glossary.html#package_designator"
><EM CLASS="term"
>package designator</EM
></A
>. The default is the <A HREF="26_1_Glossary.html#current_package"
><EM CLASS="term"
>current package</EM
></A
>.</P
></DD
><DT
><B
>Description</B
></DT
><DD
><P CLASS="j"
><A HREF="f_export.html" CLASS="funref"
><B
>export</B
></A
> makes one or more <VAR CLASS="param"
>symbols</VAR
> that are <A HREF="26_1_Glossary.html#accessible"
><EM CLASS="term"
>accessible</EM
></A
> in <VAR CLASS="param"
>package</VAR
> (whether directly or by inheritance) be <A HREF="26_1_Glossary.html#external_symbol"
><EM CLASS="term"
>external symbols</EM
></A
> of that <VAR CLASS="param"
>package</VAR
>. </P
><P CLASS="j"
>If any of the <VAR CLASS="param"
>symbols</VAR
> is already <A HREF="26_1_Glossary.html#accessible"
><EM CLASS="term"
>accessible</EM
></A
> as an <A HREF="26_1_Glossary.html#external_symbol"
><EM CLASS="term"
>external symbol</EM
></A
> of <VAR CLASS="param"
>package</VAR
>, <A HREF="f_export.html" CLASS="funref"
><B
>export</B
></A
> has no effect on that <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
>. If the <VAR CLASS="param"
>symbol</VAR
> is <A HREF="26_1_Glossary.html#present"
><EM CLASS="term"
>present</EM
></A
> in <VAR CLASS="param"
>package</VAR
> as an internal symbol, it is simply changed to external status. If it is <A HREF="26_1_Glossary.html#accessible"
><EM CLASS="term"
>accessible</EM
></A
> as an <A HREF="26_1_Glossary.html#internal_symbol"
><EM CLASS="term"
>internal symbol</EM
></A
> via <A HREF="f_use-package.html" CLASS="funref"
><B
>use-package</B
></A
>, it is first <A HREF="26_1_Glossary.html#import"
><EM CLASS="term"
>imported</EM
></A
> into <VAR CLASS="param"
>package</VAR
>, then <A HREF="26_1_Glossary.html#exported"
><EM CLASS="term"
>exported</EM
></A
>. (The <VAR CLASS="param"
>symbol</VAR
> is then <A HREF="26_1_Glossary.html#present"
><EM CLASS="term"
>present</EM
></A
> in the <VAR CLASS="param"
>package</VAR
> whether or not <VAR CLASS="param"
>package</VAR
> continues to use the <A HREF="26_1_Glossary.html#package"
><EM CLASS="term"
>package</EM
></A
> through which the <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
> was originally inherited.) </P
><P CLASS="j"
><A HREF="f_export.html" CLASS="funref"
><B
>export</B
></A
> makes each <VAR CLASS="param"
>symbol</VAR
> <A HREF="26_1_Glossary.html#accessible"
><EM CLASS="term"
>accessible</EM
></A
> to all the <A HREF="26_1_Glossary.html#package"
><EM CLASS="term"
>packages</EM
></A
> that use <VAR CLASS="param"
>package</VAR
>. All of these <A HREF="26_1_Glossary.html#package"
><EM CLASS="term"
>packages</EM
></A
> are checked for name conflicts: <CODE CLASS="f"
>(export <I CLASS="i"
><I
>s</I
></I
> <I CLASS="i"
><I
>p</I
></I
>)</CODE
> does <CODE CLASS="f"
>(find-symbol (symbol-name <I CLASS="i"
><I
>s</I
></I
>) <I CLASS="i"
><I
>q</I
></I
>)</CODE
> for each package <I CLASS="i"
><I
>q</I
></I
> in <CODE CLASS="f"
>(package-used-by-list <I CLASS="i"
><I
>p</I
></I
>)</CODE
>. Note that in the usual case of an <A HREF="f_export.html" CLASS="funref"
><B
>export</B
></A
> during the initial definition of a <A HREF="26_1_Glossary.html#package"
><EM CLASS="term"
>package</EM
></A
>, the result of <A HREF="f_package-used-by-list.html" CLASS="funref"
><B
>package-used-by-list</B
></A
> is <SPAN CLASS="misc"
><B
>nil</B
></SPAN
> and the name-conflict checking takes negligible time. When multiple changes are to be made, for example when <A HREF="f_export.html" CLASS="funref"
><B
>export</B
></A
> is given a <VAR CLASS="param"
>list</VAR
> of <VAR CLASS="param"
>symbols</VAR
>, it is permissible for the implementation to process each change separately, so that aborting from a name conflict caused by any but the first <VAR CLASS="param"
>symbol</VAR
> in the <A HREF="26_1_Glossary.html#list"
><EM CLASS="term"
>list</EM
></A
> does not unexport the first <VAR CLASS="param"
>symbol</VAR
> in the <VAR CLASS="param"
>list</VAR
>. However, aborting from a name-conflict error caused by <A HREF="f_export.html" CLASS="funref"
><B
>export</B
></A
> of one of <VAR CLASS="param"
>symbols</VAR
> does not leave that <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
> <A HREF="26_1_Glossary.html#accessible"
><EM CLASS="term"
>accessible</EM
></A
> to some <A HREF="26_1_Glossary.html#package"
><EM CLASS="term"
>packages</EM
></A
> and <A HREF="26_1_Glossary.html#inaccessible"
><EM CLASS="term"
>inaccessible</EM
></A
> to others; with respect to each of <VAR CLASS="param"
>symbols</VAR
> processed, <A HREF="f_export.html" CLASS="funref"
><B
>export</B
></A
> behaves as if it were as an atomic operation. </P
><P CLASS="j"
>A name conflict in <A HREF="f_export.html" CLASS="funref"
><B
>export</B
></A
> between one of <VAR CLASS="param"
>symbols</VAR
> being exported and a <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
> already <A HREF="26_1_Glossary.html#present"
><EM CLASS="term"
>present</EM
></A
> in a <A HREF="26_1_Glossary.html#package"
><EM CLASS="term"
>package</EM
></A
> that would inherit the newly-exported <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
> may be resolved in favor of the exported <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
> by uninterning the other one, or in favor of the already-present <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
> by making it a shadowing symbol.</P
></DD
><DT
><B
>Examples</B
></DT
><DD
><PRE CLASS="screen"
>(make-package 'temp :use nil) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> #&lt;PACKAGE "TEMP"&gt;
(use-package 'temp) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> T
(intern "TEMP-SYM" 'temp) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> TEMP::TEMP-SYM, NIL
(find-symbol "TEMP-SYM") <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> NIL, NIL
(export (find-symbol "TEMP-SYM" 'temp) 'temp) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> T
(find-symbol "TEMP-SYM") <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> TEMP-SYM, :INHERITED</PRE
></DD
><DT
><B
>Side Effects</B
></DT
><DD
><P CLASS="j"
>The package system is modified.</P
></DD
><DT
><B
>Affected By</B
></DT
><DD
><P CLASS="j"
><A HREF="26_1_Glossary.html#accessible"
><EM CLASS="term"
>Accessible</EM
></A
> <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbols</EM
></A
>.</P
></DD
><DT
><B
>Exceptional Situations</B
></DT
><DD
><P CLASS="j"
>If any of the <VAR CLASS="param"
>symbols</VAR
> is not <A HREF="26_1_Glossary.html#accessible"
><EM CLASS="term"
>accessible</EM
></A
> at all in <VAR CLASS="param"
>package</VAR
>, an error of <A HREF="26_1_Glossary.html#type"
><EM CLASS="term"
>type</EM
></A
> <A HREF="t_package-error.html" CLASS="typeref"
><B
>package-error</B
></A
> is signaled that is <A HREF="26_1_Glossary.html#correctable"
><EM CLASS="term"
>correctable</EM
></A
> by permitting the <A HREF="26_1_Glossary.html#user"
><EM CLASS="term"
>user</EM
></A
> to interactively specify whether that <A HREF="26_1_Glossary.html#symbol"
><EM CLASS="term"
>symbol</EM
></A
> should be <A HREF="26_1_Glossary.html#import"
><EM CLASS="term"
>imported</EM
></A
>.</P
></DD
><DT
><B
>See Also</B
></DT
><DD
><P CLASS="j"
><A HREF="f_import.html" CLASS="funref"
><B
>import</B
></A
>, <A HREF="f_unexport.html" CLASS="funref"
><B
>unexport</B
></A
>, <A HREF="11_1_Package_Concepts.html#sec_11_1" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>11.1</SPAN
> <SPAN CLASS="cmr"
>(Package</SPAN
> <SPAN CLASS="cmr"
>Concepts)</SPAN
></A
></P
></DD
></DL
></DIV
></DIV
><DIV CLASS="footer"
><DIV CLASS="btmnav"
><A HREF="t_package.html" CLASS="prev"
>&#8592;</A
><A HREF="f_find-symbol.html" CLASS="next"
>&#8594;</A
></DIV
><DIV CLASS="trail"
>Conversion to HTML copyright 2023 by Gilbert Baumann</DIV
></DIV
></DIV
><SCRIPT
>domReady();</SCRIPT
></BODY
></HTML
>