User Tools

Site Tools


ch2_3_pack_sym

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ch2_3_pack_sym [2022/02/25 00:46] adminch2_3_pack_sym [2025/01/29 08:35] (current) admin
Line 42: Line 42:
 <code lisp> <code lisp>
 (find-symbol "PI" 'user)      ; USER package will be searched as above (find-symbol "PI" 'user)      ; USER package will be searched as above
-:INHERITED 
 </code> </code>
  
Line 49: Line 48:
 <code lisp> <code lisp>
 (find-symbol "PI" *PACKAGE*)  ; *PACKAGE* is global variable  (find-symbol "PI" *PACKAGE*)  ; *PACKAGE* is global variable 
-:INHERITED 
 </code> </code>
  
Line 122: Line 120:
 >(in-package "P1"   ; assuming we made the P1 package in previous example >(in-package "P1"   ; assuming we made the P1 package in previous example
 #<The P1 package> #<The P1 package>
 +</code>
 +
 +''LIST-ALL-PACKAGES''
 +
 +No arguments, returns list of all packages in the environment.
 +
 +<code lisp>
 +>(list-all-packages)    
 +(#<The USER package> #<The LABLISP package> #<The KEYWORD package> ; vanilla lablisp environment
 </code> </code>
  
 ''USE-PACKAGE'' ''USE-PACKAGE''
 +
 +Adds one or more packages to be used by a target package. Exported symbols from the source package(s), will be accessible through the target package. First argument is package designator or list of package designators. Second argument is optional target package designator, default is the dynamic current package.((dynamic current package means package bound to *PACKAGE* symbol in dynamic environment)) 
 +
 +Beware of name conflicts!
 +
 +<code lisp>
 +>(use-package "P1" "P2"    ; use P1 in P2 
 +T
 +</code>
  
 ''UNUSE-PACKAGE'' ''UNUSE-PACKAGE''
 +
 +Removes one or more packages from a target package's use list. First argument is package designator or list of package designators to be removed. Second argument is optional target package designator, default is the dynamic current package. 
 +
 +<code lisp>
 +>(unuse-package "P1" "P2"  ; stop using P1 in P2 
 +T
 +</code>
 +
 +''PACKAGE-USE-LIST''
 +
 +Lists all packages that are used by a target package. Single argument is target package designator. The argument is optional, defaults to the dynamic current package. 
 +
 +Following two examples assume the situation after the ''USE-PACKAGE'' example above.
 +
 +<code lisp>
 +>(package-use-list "P2"                      
 +(#<The P1 package> #<The LABLISP package>   ; any new package has access to base lablisp
 +</code>
 +
 +''PACKAGE-USED-BY-LIST''
 +
 +Lists all packages that use a target package. Single argument is target package designator. The argument is optional, defaults to the dynamic current package. 
 +
 +<code lisp>
 +>(package-used-by-list "P1")
 +(#<The P2 package>            ; package P1 is used by P2
 +</code>
 +
  
 ''IMPORT'' ''IMPORT''
  
-''EXPORT''+Symbol becomes internal of the target package, if the symbol was //homeless//, the target package becomes symbol's home package. First argument is symbol or list of symbols. Second argument is optional target package designator, default is the dynamic current package. 
 + 
 +Beware of name conflicts! 
  
 ''UNINTERN'' ''UNINTERN''
  
-''UNEXPORT''+Removes symbol from package, so it is no longer accessible as internal or external symbol. If the package is the symbol's home pacakge, then the symbol becomes //homeless//. First argument is symbol or list of symbols. Second argument is optional target package designator, default is the dynamic current package.
  
-''LIST-ALL-PACKAGES''+The name ''UNINTERN'' is slightly misleading, the command is mostly used to revert ''IMPORT'', but it revets ''INTERN'' as well.
  
-''PACKAGE-USE-LIST''+''EXPORT''
  
-''PACKAGE-USED-BY-LIST''+Makes inherited or internal symbol to be external in given package. If the symbol is inherited, ''EXPORT'' will first ''IMPORT'' the symbol, them move from internal list to external list. First argument is symbol or list of symbols. Second argument is optional target package designator, default is the dynamic current package. 
 + 
 +Beware of name conflicts! 
 + 
 +''UNEXPORT'' 
 + 
 +Undoes ''EXPORT'', moves symbol from external list to internal list. First argument is symbol or list of symbols. Second argument is optional target package designator, default is the dynamic current package.
  
 ''PACKAGE-INTERNAL-SYMBOLS'' ''PACKAGE-INTERNAL-SYMBOLS''
 +
 +Lists all internal symbols of a target package. Single argument is target package designator. The argument is optional, defaults to the dynamic current package. 
  
 ''PACKAGE-EXTERNAL-SYMBOLS''  ''PACKAGE-EXTERNAL-SYMBOLS'' 
 +
 +Lists all external symbols of a target package. Single argument is target package designator. The argument is optional, defaults to the dynamic current package. 
  
  
  
  
ch2_3_pack_sym.1645775174.txt.gz · Last modified: 2022/02/25 00:46 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki