The global-vars Reference Manual

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

The global-vars Reference Manual

This is the global-vars Reference Manual, version 1.0.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed Jun 15 04:41:23 2022 GMT+0.

Table of Contents


1 Introduction

global-vars

Define efficient global variables in Common Lisp.

Synopsis

;; Similar to defparameter with regard to redefinitions
(define-global-parameter -x- 3)

;; Similar to defvar with regard to redefinitions
(define-global-var -y- 4)

;; ...

(setf -x- 5)
(setf -y- 6)

Description

In Common Lisp, a special variable that is never dynamically bound typically serves as a stand-in for a global variable. The global-vars library provides true global variables that are implemented by some compilers. An attempt to rebind a global variable properly results in a compiler error. That is, a global variable cannot be dynamically bound.

Global variables therefore allow us to communicate an intended usage that differs from special variables. Global variables are also more efficient than special variables, especially in the presence of threads.

API

Detail

global-vars wraps the following implementation-specific features:

For these implementations, rebinding a global variable is a compilation error.

On other implementations, a global variable is implemented as a symbol macro which expands to a symbol-value form. Rebinding a global variable will (unfortunately) not signal an error.

It is recommended to use a naming convention for global variables, such as -foo-. This makes it clear that (let ((-foo- 9)) ...) is a mistake even if the compiler doesn't catch it.

Author

James M. Lawrence llmjjmll@gmail.com


2 Systems

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


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

2.1 global-vars

Define efficient global variables.

Author

James M. Lawrence <llmjjmll@gmail.com>

License

MIT

Version

1.0.0

Source

global-vars.asd.

Child Component

global-vars.lisp (file).


3 Files

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


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

3.1 Lisp


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

3.1.1 global-vars/global-vars.asd

Source

global-vars.asd.

Parent Component

global-vars (system).

ASDF Systems

global-vars.


3.1.2 global-vars/global-vars.lisp

Source

global-vars.asd.

Parent Component

global-vars (system).

Packages

global-vars.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


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

4.1 global-vars

Source

global-vars.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

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


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

5.1 Public Interface


5.1.1 Macros

Macro: define-global-parameter (name value &optional documentation)
Package

global-vars.

Source

global-vars.lisp.

Macro: define-global-parameter* (name value &optional documentation)
Package

global-vars.

Source

global-vars.lisp.

Macro: define-global-var (name value &optional documentation)
Package

global-vars.

Source

global-vars.lisp.

Macro: define-global-var* (name value &optional documentation)
Package

global-vars.

Source

global-vars.lisp.


5.2 Internals


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

5.2.1 Constants

Constant: +value-key+
Package

global-vars.

Source

global-vars.lisp.


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

5.2.2 Macros

Macro: store-in-symbol-plist (name value key)
Package

global-vars.

Source

global-vars.lisp.


Appendix A Indexes


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

A.1 Concepts


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

A.3 Variables

Jump to:   +  
C  
Index Entry  Section

+
+value-key+: Private constants

C
Constant, +value-key+: Private constants

Jump to:   +  
C