Next: , Previous: map-declaration-env, Up: API


merge-declaration-envs

Syntax

— Function: merge-declaration-envs declaration-env1 declaration-env2 ⇒ result-env

Arguments and Values

declaration-env1
A declaration-env.
declaration-env2
A declaration-env.
result-env
A fresh declaration-env.

Description

The function merge-declaration-envs returns the union of the declaration specifiers in declaration-env1 and declaration-env2 as a new declaration-env. There is no attempt made at removing duplicates, or at any other kind of normalization.

Examples

  PARSE-DECLARATIONS> (defparameter *env* (parse-declarations '((declare (optimize speed))
                                                                (declare (fixnum x y))
                                                                (declare (inline +)))))
  => *ENV*
  PARSE-DECLARATIONS> (defparameter *env2* (parse-declarations '((declare (type fixnum y z))
                                                                 (declare (notinline +))
                                                                 (declare (optimize (safety 3))))))
  => *ENV2*
  PARSE-DECLARATIONS> (build-declarations 'declare (merge-declaration-envs *env* *env2*))
  => ((DECLARE (NOTINLINE +))
             (DECLARE (INLINE +))
             (DECLARE (TYPE FIXNUM X Y))
             (DECLARE (TYPE FIXNUM Y Z))
             (DECLARE (OPTIMIZE SPEED))
             (DECLARE (OPTIMIZE (SAFETY 3))))

Exceptional Situations

Signals an error of type TYPE-ERROR if declaration-env1 or declaration-env2 is not a declaration-env.