MacroPackage: exclToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.1
New since 8.1 release.

defvar-nonbindable

Arguments: symbol &optional initial-value-form documentation-string

This macro was added by a patch released in July, 2009. This macro will not be defined if that patch has not been installed. See sys:update-allegro for information on downloading patches.

In 8.1, signaling an error when a nonbindable variable is bound or used as a function argument is not implemented. Such forms will start signaling errors in version 8.2. However, the variable is marked as global only and is suitable as the second argument to, say, push-atomic while a variable defined by defvar would not be suitable as the second argument to push-atomic.

This macro acts like a defvar, with the additional function of flagging symbol so that it cannot be lambda-bound. This means all references to symbol's value are to (globalq symbol) (= (sys:global-symbol-value 'symbol)). The atomic-update macros recognize this and expand appropriately.

Here is an example showing the error signaled when there is an attempt to bind a non-bindable variable.


;; No error is signaled in version 8.1

cl-user(1): (defvar-nonbindable *foo*)
*foo*
cl-user(2): (setq *foo* 10)
10
cl-user(3): (let ((*foo* 20)) *foo*)
Error: Cannot bind *foo* -- it is an unbindable symbol.
  [condition type: program-error]

Restart actions (select using :continue):
 0: Prompt for a new variable name.
 1: Return to Top Level (an "abort" restart).
 2: Abort entirely from this (lisp) process.
[1c] cl-user(4): 

See smp.htm and multiprocessing.htm for more information on this macro and on multiprocessing.


Copyright (c) 1998-2009, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 8.1. This page is new in the 8.1 release.
Created 2007.4.30.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.1
New since 8.1 release.