The global-vars Reference Manual

Table of Contents

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 2.3 "Robert April" on Tue Feb 20 08:45:09 2018 GMT+0.


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

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


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 global-vars

Author

James M. Lawrence <llmjjmll@gmail.com>

License

MIT

Description

Define efficient global variables.

Version

1.0.0

Source

global-vars.asd (file)

Component

global-vars.lisp (file)


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

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 files   [Contents][Index]

3.1.1 global-vars.asd

Location

global-vars.asd

Systems

global-vars (system)


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

3.1.2 global-vars/global-vars.lisp

Parent

global-vars (system)

Location

global-vars.lisp

Packages

global-vars

Exported Definitions
Internal Definitions

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

4 Packages

Packages are listed by definition order.


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

4.1 global-vars

Source

global-vars.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

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

5 Definitions

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


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

5.1 Exported definitions


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

5.1.1 Macros

Macro: define-global-parameter NAME VALUE &optional DOCUMENTATION

Same as ‘define-global-var‘ except subsequent redefinitions will update the value (like ‘defparameter‘).

Package

global-vars

Source

global-vars.lisp (file)

Macro: define-global-parameter* NAME VALUE &optional DOCUMENTATION

Same as ‘define-global-parameter‘ except ‘value‘ is evaluated at load time, not compile time.

Package

global-vars

Source

global-vars.lisp (file)

Macro: define-global-var NAME VALUE &optional DOCUMENTATION

Define a global variable with a compile-time value.

Subsequent redefinitions will not change the value (like ‘defvar’).

The ‘value’ argument is evaluated at compile-time. On SBCL, this permits optimizations based upon the invariant that ‘name’ is always bound.

Package

global-vars

Source

global-vars.lisp (file)

Macro: define-global-var* NAME VALUE &optional DOCUMENTATION

Same as ‘define-global-var‘ except ‘value‘ is evaluated at load time, not compile time.

Package

global-vars

Source

global-vars.lisp (file)


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

5.2 Internal definitions


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

5.2.1 Constants

Constant: +value-key+
Package

global-vars

Source

global-vars.lisp (file)


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

5.2.2 Macros

Macro: store-in-symbol-plist NAME VALUE KEY
Package

global-vars

Source

global-vars.lisp (file)


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

Appendix A Indexes


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

A.1 Concepts

Jump to:   F   G   L  
Index Entry  Section

F
File, Lisp, global-vars.asd: The global-vars<dot>asd file
File, Lisp, global-vars/global-vars.lisp: The global-vars/global-vars<dot>lisp file

G
global-vars.asd: The global-vars<dot>asd file
global-vars/global-vars.lisp: The global-vars/global-vars<dot>lisp file

L
Lisp File, global-vars.asd: The global-vars<dot>asd file
Lisp File, global-vars/global-vars.lisp: The global-vars/global-vars<dot>lisp file

Jump to:   F   G   L  

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

A.2 Functions

Jump to:   D   M   S  
Index Entry  Section

D
define-global-parameter: Exported macros
define-global-parameter*: Exported macros
define-global-var: Exported macros
define-global-var*: Exported macros

M
Macro, define-global-parameter: Exported macros
Macro, define-global-parameter*: Exported macros
Macro, define-global-var: Exported macros
Macro, define-global-var*: Exported macros
Macro, store-in-symbol-plist: Internal macros

S
store-in-symbol-plist: Internal macros

Jump to:   D   M   S  

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

A.3 Variables

Jump to:   +  
C  
Index Entry  Section

+
+value-key+: Internal constants

C
Constant, +value-key+: Internal constants

Jump to:   +  
C  

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

A.4 Data types

Jump to:   G   P   S  
Index Entry  Section

G
global-vars: The global-vars system
global-vars: The global-vars package

P
Package, global-vars: The global-vars package

S
System, global-vars: The global-vars system

Jump to:   G   P   S