User Tools


This shows you the differences between two versions of the page.

Link to this comparison view

cl:functions:export [2019/06/15 02:00]
cl:functions:export [2019/06/16 07:00] (current)
Line 1: Line 1:
 +====== Function EXPORT ======
 +  * **export** //symbols ''&​optional''​ package// → **[[CL:​Constant Variables:​t]]**
 +====Arguments and Values====
 +  * //symbols// - a //​[[CL:​Glossary:​designator]]//​ for a //​[[CL:​Glossary:​list]]//​ of //​[[CL:​Glossary:​symbols]]//​.
 +  * //package// - a //​[[CL:​Glossary:​package designator]]//​. The default is the //​[[CL:​Glossary:​current package]]//​.
 +**export** makes one or more //symbols// that are //​[[CL:​Glossary:​accessible]]//​ in //package// (whether directly or by inheritance) be //​[[CL:​Glossary:​external symbols]]// of that //​package//​.
 +If any of the //symbols// is already //​[[CL:​Glossary:​accessible]]//​ as an //​[[CL:​Glossary:​external symbol]]// of //​package//,​ **export** has no effect on that //​[[CL:​Glossary:​symbol]]//​. If the //symbol// is //​[[CL:​Glossary:​present]]//​ in //package// as an internal symbol, it is simply changed to external status. If it is //​[[CL:​Glossary:​accessible]]//​ as an //​[[CL:​Glossary:​internal symbol]]// via **[[CL:​Functions:​use-package]]**,​ it is first //​[[CL:​Glossary:​import|imported]]//​ into //​package//,​ then //​[[CL:​Glossary:​exported]]//​. (The //symbol// is then //​[[CL:​Glossary:​present]]//​ in the //package// whether or not //package// continues to use the //​[[CL:​Glossary:​package]]//​ through which the //​[[CL:​Glossary:​symbol]]//​ was originally inherited.)
 +**export** makes each //symbol// //​[[CL:​Glossary:​accessible]]//​ to all the //​[[CL:​Glossary:​package|packages]]//​ that use //​package//​. All of these //​[[CL:​Glossary:​package|packages]]//​ are checked for name conflicts: ''​(export //s// //​p//​)''​ does ''​([[CL:​Functions:​find-symbol]] ([[CL:​Functions:​symbol-name]] //s//) //​q//​)''​ for each package ''​q''​ in ''​([[CL:​Functions:​package-used-by-list]] //​p//​)''​. Note that in the usual case of an **export** during the initial definition of a //​[[CL:​Glossary:​package]]//,​ the result of **[[CL:​Functions:​package-used-by-list]]** is **[[CL:​Constant Variables:​nil]]** and the name-conflict checking takes negligible time. When multiple changes are to be made, for example when **export** is given a //list// of //​symbols//,​ it is permissible for the implementation to process each change separately, so that aborting from a name conflict caused by any but the first //symbol// in the //​[[CL:​Glossary:​list]]//​ does not unexport the first //symbol// in the //list//. However, aborting from a name-conflict error caused by **export** of one of //symbols// does not leave that //​[[CL:​Glossary:​symbol]]//​ //​[[CL:​Glossary:​accessible]]//​ to some //​[[CL:​Glossary:​package|packages]]//​ and //​[[CL:​Glossary:​inaccessible]]//​ to others; with respect to each of //symbols// processed, **export** behaves as if it were as an atomic operation.
 +A name conflict in **export** between one of //symbols// being exported and a //​[[CL:​Glossary:​symbol]]//​ already //​[[CL:​Glossary:​present]]//​ in a //​[[CL:​Glossary:​package]]//​ that would inherit the newly-exported //​[[CL:​Glossary:​symbol]]//​ may be resolved in favor of the exported //​[[CL:​Glossary:​symbol]]//​ by uninterning the other one, or in favor of the already-present //​[[CL:​Glossary:​symbol]]//​ by making it a shadowing symbol.
 +([[CL:​Functions:​make-package]] 'temp :use nil) <​r>#<​PACKAGE "​TEMP"></​r>​
 +([[CL:​Functions:​use-package]] 'temp) <r>T </r>
 +([[CL:​Functions:​intern]] "​TEMP-SYM"​ 'temp) <​r>​TEMP::​TEMP-SYM
 +NIL </r>
 +([[CL:​Functions:​find-symbol]] "​TEMP-SYM"​) <​r>​NIL
 +NIL </r>
 +(export ([[CL:​Functions:​find-symbol]] "​TEMP-SYM"​ 'temp) 'temp) <r>T </r>
 +([[CL:​Functions:​find-symbol]] "​TEMP-SYM"​) <​r>​TEMP-SYM
 +====Side Effects====
 +The package system is modified.
 +====Affected By====
 +//​[[CL:​Glossary:​accessible|Accessible]]//​ //​[[CL:​Glossary:​symbols]]//​.
 +====Exceptional Situations====
 +If any of the //symbols// is not //​[[CL:​Glossary:​accessible]]//​ at all in //​package//,​ an error of type **[[CL:​Types:​package-error]]** is signaled that is //​[[CL:​Glossary:​correctable]]//​ by permitting the //​[[CL:​Glossary:​user]]//​ to interactively specify whether that //​[[CL:​Glossary:​symbol]]//​ should be //​[[CL:​Glossary:​import|imported]]//​.
 +====See Also====
 +  * **[[CL:​Functions:​import]]**
 +  * **[[CL:​Functions:​unexport]]**
 +  * {\secref\PackageConcepts}