declare
(declare declaration...)
A declaration other than special never changes what a program computes: the whole declare form evaluates to nil and its arguments are never evaluated or validated, so any standard declaration (ignore, ignorable, type, optimize, inline, special, ...) is accepted anywhere in a body, and source code written for other Common Lisp implementations loads unchanged.
Four declaration families do affect compilation. A (declare (special ...)) at the head of a body makes a binding of a listed variable that the form establishes dynamic, and the references to it in that body read the dynamic binding, as in standard CL; an inner binding of the same name is lexical unless it is declared special too. On the WASM backend, a type declaration that names an array type -- (simple-array (unsigned-byte 8) (*)), simple-vector, ... -- or such an array or nil, (or null simple-vector), lets the compiler emit that one representation's element accessors directly, which makes the compiled module smaller and faster; an element of a general array whose element type is a range of integers, (simple-array (signed-byte 64) (*)), is read in integer arithmetic as a raw machine integer. One that names a range of integers within 64 bits -- (signed-byte 32), (unsigned-byte 16), (integer 0 255), (mod 10), a deftype of one -- lets it take the variable, or the value of a (the ...) form, as a raw machine integer with no generic path for any other value, which makes the arithmetic over it smaller and faster; fixnum names no range here, since every integer is a fixnum to typep. And on the JVM backend, a type declaration that names a float type -- double-float, single-float, or float -- keeps the declared local variables in raw double slots and compiles arithmetic over them as unboxed machine instructions, which makes the compiled class faster, especially before the JIT warms up; the integer ranges above let its fused integer arithmetic take the value with no generic path for any other value, which makes the compiled class smaller, and keep a declared local variable read mostly in integer arithmetic in a raw long slot, so a statement that computes it allocates nothing, which makes the compiled class faster. Results are unaffected by a correct declaration; a false one, which is undefined behavior in Common Lisp, traps on WASM where the declared value is accessed and signals a catchable error at the declared read or store on the JVM (where an integer outside a declared range but within 64 bits is computed as if undeclared), while the interpreter continues to ignore it.