《通链参考手册》


Special Operator LOCALLY

●语法设定:

locally declaration* form* => result*

●参数和值:

Declaration---a declare expression; not evaluated.

forms---an implicit progn.

results---the values of the forms.

●详情:

Sequentially evaluates a body of forms in a lexical environment where the given declarations have effect.

●例子:

 (defun sample-function (y)  ;this y is regarded as special
   (declare (special y))                                
   (let ((y t))              ;this y is regarded as lexical
     (list y
           (locally (declare (special y))
             ;; this next y is regarded as special
             y))))
=>  SAMPLE-FUNCTION
 (sample-function nil) =>  (T NIL) 
 (setq x '(1 2 3) y '(4 . 5)) =>  (4 . 5)

;;; The following declarations are not notably useful in specific.
;;; They just offer a sample of valid declaration syntax using LOCALLY.
 (locally (declare (inline floor) (notinline car cdr))
          (declare (optimize space))
    (floor (car x) (cdr y))) =>  0, 1

;;; This example shows a definition of a function that has a particular set
;;; of OPTIMIZE settings made locally to that definition.
 (locally (declare (optimize (safety 3) (space 3) (speed 0)))
   (defun frob (w x y &optional (z (foo x y)))
     (mumble x y z w)))
=>  FROB

;;; This is like the previous example, except that the optimize settings
;;; remain in effect for subsequent definitions in the same compilation unit.
 (declaim (optimize (safety 3) (space 3) (speed 0)))
 (defun frob (w x y &optional (z (foo x y)))
   (mumble x y z w))
=>  FROB

●副作用: None.

●受制于: 无。

●例外情况: 无。

●更多信息:

declare

●说明:

The special declaration may be used with locally to affect references to, rather than bindings of, variables.

If a locally form is a top level form, the body forms are also processed as top level forms. See Section 3.2.3 (File Compilation).


X3J13设计清单非标准部分,可查下面章节:


◇首页 § ◎章节目录 § □内容索引 § ○符号索引 § △术语表 § ※设计草案