title: Why can't constants be used as array dimensions in Common Lisp type specifiers?
body: <p>At least some implementations of Common Lisp don't allow user-defined constants to be used as array dimensions in some type specifiers.  For example, in SBCL, this code:</p>
  
  <pre><code>(defconstant +len+ 3)
  
  (defun foo (x) 
    (declare (type (simple-array fixnum (+len+)) x))
    x)
  </code></pre>
  
  <p>generates this error:</p>
  
  <pre><code>; in: DEFUN FOO
  ;     (TYPE (SIMPLE-ARRAY FIXNUM (+LEN+)) X)
  ; 
  ; caught ERROR:
  ;   bad dimension in array type: +LEN+
  </code></pre>
  
  <p>Why? It seems surprising that user-defined constants can't be used in type specifiers, since it would be desirable to be able to coordinate multiple type specifiers using some kind of global definition.  I understand that type specifiers need to be completely understandable at compile-time.  But I would have thought that a compiler would be able to replace symbols defined with <code>defconstant</code> by their literal values.  I would have thought that this was one of the purposes of <code>defconstant</code>.  (I've been unsuccessful, so far, in getting deeper understanding of this issue from the Common Lisp Hyperspec, CLTL2, the SBCL manual, or what Google has turned up.  I suspect the answer is there in some form ....)</p>