The cl-environments Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-environments Reference Manual

This is the cl-environments Reference Manual, version 0.2, generated automatically by Declt version 2.4 patchlevel 1 "Will Decker" on Fri May 24 08:05:36 2019 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

CL-ENVIRONMENTS - CLTL2 Environment Access Compatibility Layer

This library provides a uniform API, as specified in Common Lisp the Language 2, for accessing information about variable and function bindings from implementation-defined lexical environment objects. All major Common Lisp implementations are supported, even those which don't support the CLTL2 environment access API.

On implementations, which provide the CLTL2 environment access API, this library is simply a wrapper which handles the peculiarities of each implementation.

ON implementations, which do not provide the CLTL2 environment access API, the environment information is extracted using a code-walker bound to *MACROEXPAND-HOOK*.

The following functions/macros are provided by this library on all implementations:

AUGMENT-ENVIRONMENT is not provided as it cannot be implemented on implementations which do not provide the functionality natively, since it requires that all functions, which take an environment parameter, be overridden to handle the extended environment objects.

Documentation

To be able to use the environment access functions, ENABLE-HOOK has to be called to ensure that the code walker is set as the macroexpansion hook on implementations where the code-walker is required. On implementations where the code-walker is not required ENABLE-HOOK and DISABLE-HOOK do nothing.

The CL-ENVIRONMENTS package is a clone of the COMMON-LISP package with the exception that all CL special operators, which modify the environment, are shadowed and replaced with macro definitions to ensure that the code-walker walks all forms, including forms appearing at top-level. This package should be used, instead of the COMMON-LISP package, in order to be able to obtain accurate information about the environment from top-level special forms.

ENABLE-HOOK

Function: ENABLE-HOOK &OPTIONAL PREVIOUS-HOOK

Sets the code-walker as the *MACROEXPAND-HOOK* if necessary. PREVIOUS-HOOK, if provided, is the function to restore *MACROEXPAND-HOOK* to when calling DISABLE-HOOK. If not provided defaults to the current value of *MACROEXPAND-HOOK*.

DISABLE-HOOK

Function: DISABLE-HOOK &OPTIONAL PREVIOUS-HOOK

Restores *MACROEXPAND-HOOK* to its previous value prior to calling ENABLE-HOOK.

If PREVIOUS-HOOK is provided restores *MACROEXPAND-HOOK* to that value instead.

Environment Access Functions

See Common Lisp the Language 2 for the Environments API specification.

VARIABLE-INFORMATION

Function: VARIABLE-INFORMATION SYMBOL &OPTIONAL ENV

Returns information about the variable binding for symbol SYMBOL, in the lexical environment ENV. ENV defaults to the NIL global environment if it is not provided.

Returns three values.

The first value is one of the following identifying the type of binding:

The second return value is T if there is a local variable binding for SYMBOL, NIL otherwise.

The third return value is an alist containing the declaration information applying to the variable SYMBOL.

FUNCTION-INFORMATION

Function: FUNCTION-INFORMATION SYMBOL &OPTIONAL ENV

Returns information about the function binding for SYMBOL in the environment ENV. ENV defaults to the global NIL environment if it is not provided.

Returns three values.

The first value is one of the following identifying the type of binding:

The second return value is T if there is a local fucntion binding for SYMBOL, NIL otherwise.

The third return value is an alist containing the declaration information applying to the function SYMBOL.

DECLARATION-INFORMATION

Function: DECLARATION-INFORMATION NAME &OPTIONAL ENV

Returns information about the declaration named NAME in the environment ENV, which neither applies to variables nor functions. ENV defaults to the global NIL environment if it is not provided.

DEFINE-DECLARATION

Macro: DEFINE-DECLARATION NAME (ARG-VAR &OPTIONAL ENV-VAR) &BODY BODY

Defines a handler for the declaration named NAME. NAME must not name a standard CL declaration, nor an implementation-specific declaration.

ARG-VAR is the name of the variable which will be bound to the argument list of the declaration (the CDR of the declaration where the declaration is of the form (NAME . ARGS)).

If provided ENV-VAR is the name of the variable which will be bound to the lexical environment in which the declaration occurs.

BODY is the body of the declaration handler which should return two values. The first is a keyword which indicates what the declaration applies to:

If the first value is either :VARIABLE or :FUNCTION the second value should be a list where each element is of the form (SYMBOL KEY VALUE) where SYMBOL is the SYMBOL naming the binding to which the declaration applies. The CONS (KEY . VALUE) will be included in the alist returned by VARIABLE-INFORMATION/FUNCTION-INFORMATION for the symbol SYMBOL.

If the first value is :DECLARE the second value should be a CONS of the form (KEY . VALUE). VALUE will be returned by DECLARATION-INFORMATION for the declaration named KEY.

Status

Supports: Clisp, CCL, ECL, ABCL, CMUCL, SBCL, Allegro CL and LispWorks.

Defaults to the full code-walker implementation on other CL implementations. This will work if the implementation does not expand the standard CL macros to implementation-specific special forms.

Tested on: Clisp, CCL, ECL, ABCL, CMUCL and SBCL.

Issues

ABCL


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

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


Previous: , Up: Systems   [Contents][Index]

2.1 cl-environments

Author

Alexander Gutev

License

MIT

Description

Implements the CLTL2 environment access functionality for implementations which do not provide the functionality to the programmer.

Version

0.2

Dependencies
Source

cl-environments.asd (file)

Component

src (module)


Next: , Previous: , Up: Top   [Contents][Index]

3 Modules

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


Next: , Previous: , Up: Modules   [Contents][Index]

3.1 cl-environments/src

Parent

cl-environments (system)

Location

src/

Components

Next: , Previous: , Up: Modules   [Contents][Index]

3.2 cl-environments/src/common

Parent

src (module)

Location

src/common/

Components

Previous: , Up: Modules   [Contents][Index]

3.3 cl-environments/src/tools

Parent

src (module)

Location

src/tools/

Components

Next: , Previous: , Up: Top   [Contents][Index]

4 Files

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


Previous: , Up: Files   [Contents][Index]

4.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.1 cl-environments.asd

Location

cl-environments.asd

Systems

cl-environments (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.2 cl-environments/src/common/package.lisp

Parent

common (module)

Location

src/common/package.lisp

Packages

cl-environments.util


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.3 cl-environments/src/common/let-over-lambda.lisp

Parent

common (module)

Location

src/common/let-over-lambda.lisp

Exported Definitions

defmacro! (macro)

Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.4 cl-environments/src/common/util.lisp

Parent

common (module)

Location

src/common/util.lisp

Exported Definitions
Internal Definitions

gensyms (function)


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.5 cl-environments/src/common/macro-util.lisp

Parent

common (module)

Location

src/common/macro-util.lisp

Exported Definitions

match-state (macro)


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.6 cl-environments/src/other/sbcl.lisp

Parent

src (module)

Location

src/other/sbcl.lisp

Packages

cl-environments

Exported Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.7 cl-environments/src/tools/package.lisp

Parent

tools (module)

Location

src/tools/package.lisp

Packages

cl-environments.tools


Previous: , Up: Lisp files   [Contents][Index]

4.1.8 cl-environments/src/tools/types.lisp

Parent

tools (module)

Location

src/tools/types.lisp

Exported Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

5.1 cl-environments.util

Source

package.lisp (file)

Use List
Used By List

cl-environments

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Packages   [Contents][Index]

5.2 cl-environments

Source

other/sbcl.lisp (file)

Use List
Used By List

cl-environments.tools

Exported Definitions

Previous: , Up: Packages   [Contents][Index]

5.3 cl-environments.tools

Source

package.lisp (file)

Use List
Exported Definitions

Next: , Previous: , Up: Top   [Contents][Index]

6 Definitions

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


Next: , Previous: , Up: Definitions   [Contents][Index]

6.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.1 Macros

Macro: define-declaration DECL-NAME (ARG-VAR &optional ENV-VAR) &body BODY
Package

cl-environments

Source

other/sbcl.lisp (file)

Macro: defmacro! NAME ARGS &rest BODY
Package

cl-environments.util

Source

let-over-lambda.lisp (file)

Macro: let-if (&rest BINDINGS) CONDITION &body BODY

Allows variables to be initialized with different init-forms based on a condition. BINDINGS is a list of bindings where the first element is the symbol the second element is the init-form to evaluated if CONDITION evaluates to true, the second element is the init-form to evaluate if CONDITION evaluates to false.

Package

cl-environments.util

Source

util.lisp (file)

Macro: match-state ARG &body STATES

Implements an FSM where each state may specify a pattern and a list of from states, when the argument matches the pattern of a particular and the current state is in the state’s from states list, the FSM transitions to that state. Each element in STATES is a list of the following form: (STATE PATTERN [:FROM STATES] . BODY) where STATE is a symbol identifying the state, PATTERN is the pattern to be matched, and STATES is the optional list of from states (it and the :FROM keyword may be excluded), if there is only one state it does not have to be in a list. If a state specifies no from states, it is as if all declared states are specifed as from states. When a state becomes the current state the forms in its BODY are executed, in which the machine may either transition to the next state using the internal function (NEXT NEW-ARG) where NEW-ARG is the new argument to be matched against the patterns. If NEXT is never called in body the return value of the last form in BODY becomes the return value of the MATCH-STATE form. The intiial argument is given by evaluated the form ARG. The initial state may be optionally specified, when the first element of STATES is :START the second element is taken as the form to be evaluated to produce the start state, otherwise the start state defaults
to :START. Patterns are matched in the order given, the first state whose pattern matches (both the argument pattern and FROM list) becomes the current state.

Package

cl-environments.util

Source

macro-util.lisp (file)

Macro: slot-values (&rest SLOTS) O!FORM &body BODY
Package

cl-environments.util

Source

util.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

6.1.2 Functions

Function: disable-hook &optional PREVIOUS-HOOK

Does nothing, provided for compatibility with implementations where the code walker is required.

Package

cl-environments

Source

other/sbcl.lisp (file)

Function: enable-hook &optional PREVIOUS-HOOK

Does nothing, provided for compatibility with implementations where the code walker is required.

Package

cl-environments

Source

other/sbcl.lisp (file)

Function: get-return-type FORM ENV

Determines the type of the return value of the form FORM, in the environment ENV.

Package

cl-environments.tools

Source

types.lisp (file)

Function: get-return-types FORMS ENV

Determines the return value type of each form in FORMS, in the environment ENV. Returns a list where each element is the return-value type of the corresponding form in FORMS.

Package

cl-environments.tools

Source

types.lisp (file)

Function: get-value-type FORM ENV &optional N

Determines the type of the N’th value returned by FORM, in the environment ENV. If N > 0 and there is no information about the type of the N’th value, NIL is returned.

Package

cl-environments.tools

Source

types.lisp (file)

Function: reexport-all-symbols FROM-PACKAGE
Package

cl-environments.util

Source

util.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

6.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

6.2.1 Macros

Macro: defmacro/g! NAME ARGS &rest BODY
Package

cl-environments.util

Source

let-over-lambda.lisp (file)

Macro: defun! NAME ARGS &body BODY
Package

cl-environments.util

Source

let-over-lambda.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

6.2.2 Functions

Function: g!-symbol-p S
Package

cl-environments.util

Source

let-over-lambda.lisp (file)

Function: gensyms SYMS &key KEY
Package

cl-environments.util

Source

util.lisp (file)

Function: group SOURCE N
Package

cl-environments.util

Source

let-over-lambda.lisp (file)

Function: lol-flatten X
Package

cl-environments.util

Source

let-over-lambda.lisp (file)

Function: mkstr &rest ARGS
Package

cl-environments.util

Source

let-over-lambda.lisp (file)

Function: o!-symbol-p S
Package

cl-environments.util

Source

let-over-lambda.lisp (file)

Function: o!-symbol-to-g!-symbol S
Package

cl-environments.util

Source

let-over-lambda.lisp (file)

Function: symb &rest ARGS
Package

cl-environments.util

Source

let-over-lambda.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   C   F   L   M  
Index Entry  Section

C
cl-environments.asd: The cl-environments<dot>asd file
cl-environments/src: The cl-environments/src module
cl-environments/src/common: The cl-environments/src/common module
cl-environments/src/common/let-over-lambda.lisp: The cl-environments/src/common/let-over-lambda<dot>lisp file
cl-environments/src/common/macro-util.lisp: The cl-environments/src/common/macro-util<dot>lisp file
cl-environments/src/common/package.lisp: The cl-environments/src/common/package<dot>lisp file
cl-environments/src/common/util.lisp: The cl-environments/src/common/util<dot>lisp file
cl-environments/src/other/sbcl.lisp: The cl-environments/src/other/sbcl<dot>lisp file
cl-environments/src/tools: The cl-environments/src/tools module
cl-environments/src/tools/package.lisp: The cl-environments/src/tools/package<dot>lisp file
cl-environments/src/tools/types.lisp: The cl-environments/src/tools/types<dot>lisp file

F
File, Lisp, cl-environments.asd: The cl-environments<dot>asd file
File, Lisp, cl-environments/src/common/let-over-lambda.lisp: The cl-environments/src/common/let-over-lambda<dot>lisp file
File, Lisp, cl-environments/src/common/macro-util.lisp: The cl-environments/src/common/macro-util<dot>lisp file
File, Lisp, cl-environments/src/common/package.lisp: The cl-environments/src/common/package<dot>lisp file
File, Lisp, cl-environments/src/common/util.lisp: The cl-environments/src/common/util<dot>lisp file
File, Lisp, cl-environments/src/other/sbcl.lisp: The cl-environments/src/other/sbcl<dot>lisp file
File, Lisp, cl-environments/src/tools/package.lisp: The cl-environments/src/tools/package<dot>lisp file
File, Lisp, cl-environments/src/tools/types.lisp: The cl-environments/src/tools/types<dot>lisp file

L
Lisp File, cl-environments.asd: The cl-environments<dot>asd file
Lisp File, cl-environments/src/common/let-over-lambda.lisp: The cl-environments/src/common/let-over-lambda<dot>lisp file
Lisp File, cl-environments/src/common/macro-util.lisp: The cl-environments/src/common/macro-util<dot>lisp file
Lisp File, cl-environments/src/common/package.lisp: The cl-environments/src/common/package<dot>lisp file
Lisp File, cl-environments/src/common/util.lisp: The cl-environments/src/common/util<dot>lisp file
Lisp File, cl-environments/src/other/sbcl.lisp: The cl-environments/src/other/sbcl<dot>lisp file
Lisp File, cl-environments/src/tools/package.lisp: The cl-environments/src/tools/package<dot>lisp file
Lisp File, cl-environments/src/tools/types.lisp: The cl-environments/src/tools/types<dot>lisp file

M
Module, cl-environments/src: The cl-environments/src module
Module, cl-environments/src/common: The cl-environments/src/common module
Module, cl-environments/src/tools: The cl-environments/src/tools module

Jump to:   C   F   L   M  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   D   E   F   G   L   M   O   R   S  
Index Entry  Section

D
define-declaration: Exported macros
defmacro!: Exported macros
defmacro/g!: Internal macros
defun!: Internal macros
disable-hook: Exported functions

E
enable-hook: Exported functions

F
Function, disable-hook: Exported functions
Function, enable-hook: Exported functions
Function, g!-symbol-p: Internal functions
Function, gensyms: Internal functions
Function, get-return-type: Exported functions
Function, get-return-types: Exported functions
Function, get-value-type: Exported functions
Function, group: Internal functions
Function, lol-flatten: Internal functions
Function, mkstr: Internal functions
Function, o!-symbol-p: Internal functions
Function, o!-symbol-to-g!-symbol: Internal functions
Function, reexport-all-symbols: Exported functions
Function, symb: Internal functions

G
g!-symbol-p: Internal functions
gensyms: Internal functions
get-return-type: Exported functions
get-return-types: Exported functions
get-value-type: Exported functions
group: Internal functions

L
let-if: Exported macros
lol-flatten: Internal functions

M
Macro, define-declaration: Exported macros
Macro, defmacro!: Exported macros
Macro, defmacro/g!: Internal macros
Macro, defun!: Internal macros
Macro, let-if: Exported macros
Macro, match-state: Exported macros
Macro, slot-values: Exported macros
match-state: Exported macros
mkstr: Internal functions

O
o!-symbol-p: Internal functions
o!-symbol-to-g!-symbol: Internal functions

R
reexport-all-symbols: Exported functions

S
slot-values: Exported macros
symb: Internal functions

Jump to:   D   E   F   G   L   M   O   R   S  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables


Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   P   S  
Index Entry  Section

C
cl-environments: The cl-environments system
cl-environments: The cl-environments package
cl-environments.tools: The cl-environments<dot>tools package
cl-environments.util: The cl-environments<dot>util package

P
Package, cl-environments: The cl-environments package
Package, cl-environments.tools: The cl-environments<dot>tools package
Package, cl-environments.util: The cl-environments<dot>util package

S
System, cl-environments: The cl-environments system

Jump to:   C   P   S