The lisp-namespace Reference Manual

This is the lisp-namespace Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 08 18:47:36 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 lisp-namespace

Provides LISP-N — extensible namespaces in Common Lisp.

Author

Masataro Asai

Contact

License

LLGPL

Version

0.1

Dependency

alexandria (system).

Source

lisp-namespace.asd.

Child Component

src (module).


3 Modules

Modules are listed depth-first from the system components tree.


3.1 lisp-namespace/src

Source

lisp-namespace.asd.

Parent Component

lisp-namespace (system).

Child Components

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


4.1 Lisp


4.1.1 lisp-namespace/lisp-namespace.asd

Source

lisp-namespace.asd.

Parent Component

lisp-namespace (system).

ASDF Systems

lisp-namespace.

Packages

lisp-namespace-asd.


4.1.2 lisp-namespace/src/package.lisp

Source

lisp-namespace.asd.

Parent Component

src (module).

Packages

lisp-namespace.

Public Interface
Internals

4.1.3 lisp-namespace/src/namespace.lisp

Dependency

package.lisp (file).

Source

lisp-namespace.asd.

Parent Component

src (module).

Public Interface

clear-namespace (function).

Internals

4.1.4 lisp-namespace/src/namespace-let.lisp

Dependency

namespace.lisp (file).

Source

lisp-namespace.asd.

Parent Component

src (module).

Public Interface

namespace-let (macro).

Internals

5 Packages

Packages are listed by definition order.


5.1 lisp-namespace-asd

Source

lisp-namespace.asd.

Use List
  • asdf/interface.
  • common-lisp.

5.2 lisp-namespace

This package provides a method to define additional namespaces for lisp.

Common lisp is lisp-2, which means it has a different namespaces for the value and the function. With lisp-namespace, you can define arbitrary additional namespaces and its accessors as well.

The idea is simple. Common lisp has ‘symbol-value’ and ‘symbol-function’, so I added ‘symbol-anything-you-like’. Current implementation is
built on a hashtable.

Source

package.lisp.

Nickname

lispn

Use List
  • alexandria.
  • common-lisp.
Public Interface
Internals

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


6.1 Public Interface


6.1.1 Macros

Macro: define-namespace (name &optional expected-type namespace-let documentation)

This macro defines a namespace. For the given name of namespace X,
DEFINE-NAMESPACE defines 4 functions/macros:

+ #’SYMBOL-X, #’(setf SYMBOL-X) : accessor to the global binding. Optionally,
EXPECTED-TYPE provides FTYPE proclamation and results in the
better optimization. EXPECTED-TYPE is not evaluated.
+ #’X-BOUNDP : unary function returning a boolean
+ condition UNBOUND-X which is signaled when trying to access the value of an unbounded symbol. + macro (X-LET (binding...) body) : lexical binding. It is defined when BINDING is non-nil.

Package

lisp-namespace.

Source

package.lisp.

Macro: namespace-let (bindings &body body)

Bindings is a list of bindings where each car is of form (NAMESPACE NAME),
or a symbol NAME for a variable namespace.

function, macro, label, symbol-macro, handler, restart is by default recognized as a namespace.

Example:
(namespace-let ((#’x (y) (1+ y)) ; – equivalent to ((function x) (y) (1+ y))
((macro x) (y) (1+ y))
((macro y) (y) (1+ y))
(#’x (y) (1+ y))
((label y) (y) (y y))
((symbol-macro sm) 0)
(b 0))
(let ((b 1))
(print :x)))

Package

lisp-namespace.

Source

namespace-let.lisp.

Macro: nslet (bindings &body body)

Bindings is a list of bindings where each car is of form (NAMESPACE NAME),
or a symbol NAME for a variable namespace.

function, macro, label, symbol-macro, handler, restart is by default recognized as a namespace.

Example:
(namespace-let ((#’x (y) (1+ y)) ; – equivalent to ((function x) (y) (1+ y))
((macro x) (y) (1+ y))
((macro y) (y) (1+ y))
(#’x (y) (1+ y))
((label y) (y) (y y))
((symbol-macro sm) 0)
(b 0))
(let ((b 1))
(print :x)))

Package

lisp-namespace.

Alias for

namespace-let.


6.1.2 Ordinary functions

Function: clear-namespace (name)

Get rid of all values bound in the given namespaces.

Package

lisp-namespace.

Source

namespace.lisp.


6.1.3 Standalone methods

Method: make-load-form ((ns %namespace) &optional environment)
Source

package.lisp.

Method: print-object ((ns %namespace) s)
Source

package.lisp.


6.2 Internals


6.2.1 Special variables

Special Variable: *namespace-doc-table*
Package

lisp-namespace.

Source

namespace.lisp.

Special Variable: *namespace-hash*
Package

lisp-namespace.

Source

package.lisp.

Special Variable: *namespace-table*
Package

lisp-namespace.

Source

namespace.lisp.


6.2.2 Ordinary functions

Function: %merge (kind name def body rest)
Package

lisp-namespace.

Source

namespace-let.lisp.

Function: %namespace (name)
Package

lisp-namespace.

Source

package.lisp.

Reader: %namespace-accessor (instance)
Package

lisp-namespace.

Source

package.lisp.

Target Slot

accessor.

Reader: %namespace-boundp (instance)
Package

lisp-namespace.

Source

package.lisp.

Target Slot

boundp.

Reader: %namespace-condition (instance)
Package

lisp-namespace.

Source

package.lisp.

Target Slot

condition.

Reader: %namespace-doc-table (instance)
Package

lisp-namespace.

Source

package.lisp.

Target Slot

doc-table.

Reader: %namespace-hash (instance)
Package

lisp-namespace.

Source

package.lisp.

Target Slot

hash.

Reader: %namespace-letname (instance)
Package

lisp-namespace.

Source

package.lisp.

Target Slot

letname.

Reader: %namespace-name (instance)
Package

lisp-namespace.

Source

package.lisp.

Target Slot

name.

Function: %namespace-p (object)
Package

lisp-namespace.

Source

package.lisp.

Reader: %namespace-type (instance)
Package

lisp-namespace.

Source

package.lisp.

Target Slot

type.

Function: %pickone (bindings body)
Package

lisp-namespace.

Source

namespace-let.lisp.

Function: %wrap (namespace name definition body)
Package

lisp-namespace.

Source

namespace-let.lisp.

Function: copy-%namespace (instance)
Package

lisp-namespace.

Source

package.lisp.

Function: keep-upcase-or-preserve (str)
Package

lisp-namespace.

Source

package.lisp.

Function: namespace-boundp (symbol)

Automatically defined boolean function.

Package

lisp-namespace.

Source

namespace.lisp.

Function: symbol-namespace (symbol &optional default)

Automatically defined getter function. When DEFAULT is supplied, the value is set automatically.

Package

lisp-namespace.

Source

namespace.lisp.

Function: (setf symbol-namespace) (symbol)

Automatically defined setter function.

Package

lisp-namespace.

Source

namespace.lisp.


6.2.3 Conditions

Condition: unbound-namespace
Package

lisp-namespace.

Source

namespace.lisp.

Direct superclasses

unbound-variable.


6.2.4 Structures

Structure: %namespace
Package

lisp-namespace.

Source

package.lisp.

Direct superclasses

structure-object.

Direct methods
Direct slots
Slot: name
Type

symbol

Initform

(error "anonymous namespace?")

Readers

%namespace-name.

Writers

This slot is read-only.

Slot: accessor
Type

symbol

Readers

%namespace-accessor.

Writers

This slot is read-only.

Slot: hash
Type

symbol

Readers

%namespace-hash.

Writers

This slot is read-only.

Slot: condition
Package

common-lisp.

Type

symbol

Readers

%namespace-condition.

Writers

This slot is read-only.

Slot: boundp
Package

common-lisp.

Type

symbol

Readers

%namespace-boundp.

Writers

This slot is read-only.

Slot: type
Package

common-lisp.

Type

symbol

Readers

%namespace-type.

Writers

This slot is read-only.

Slot: letname
Type

symbol

Readers

%namespace-letname.

Writers

This slot is read-only.

Slot: doc-table
Type

symbol

Readers

%namespace-doc-table.

Writers

This slot is read-only.


6.2.5 Types

Type: namespace-type ()
Package

lisp-namespace.

Source

namespace.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   %   (  
C   D   F   K   M   N   P   S  
Index Entry  Section

%
%merge: Private ordinary functions
%namespace: Private ordinary functions
%namespace-accessor: Private ordinary functions
%namespace-boundp: Private ordinary functions
%namespace-condition: Private ordinary functions
%namespace-doc-table: Private ordinary functions
%namespace-hash: Private ordinary functions
%namespace-letname: Private ordinary functions
%namespace-name: Private ordinary functions
%namespace-p: Private ordinary functions
%namespace-type: Private ordinary functions
%pickone: Private ordinary functions
%wrap: Private ordinary functions

(
(setf symbol-namespace): Private ordinary functions

C
clear-namespace: Public ordinary functions
copy-%namespace: Private ordinary functions

D
define-namespace: Public macros

F
Function, %merge: Private ordinary functions
Function, %namespace: Private ordinary functions
Function, %namespace-accessor: Private ordinary functions
Function, %namespace-boundp: Private ordinary functions
Function, %namespace-condition: Private ordinary functions
Function, %namespace-doc-table: Private ordinary functions
Function, %namespace-hash: Private ordinary functions
Function, %namespace-letname: Private ordinary functions
Function, %namespace-name: Private ordinary functions
Function, %namespace-p: Private ordinary functions
Function, %namespace-type: Private ordinary functions
Function, %pickone: Private ordinary functions
Function, %wrap: Private ordinary functions
Function, (setf symbol-namespace): Private ordinary functions
Function, clear-namespace: Public ordinary functions
Function, copy-%namespace: Private ordinary functions
Function, keep-upcase-or-preserve: Private ordinary functions
Function, namespace-boundp: Private ordinary functions
Function, symbol-namespace: Private ordinary functions

K
keep-upcase-or-preserve: Private ordinary functions

M
Macro, define-namespace: Public macros
Macro, namespace-let: Public macros
Macro, nslet: Public macros
make-load-form: Public standalone methods
Method, make-load-form: Public standalone methods
Method, print-object: Public standalone methods

N
namespace-boundp: Private ordinary functions
namespace-let: Public macros
nslet: Public macros

P
print-object: Public standalone methods

S
symbol-namespace: Private ordinary functions