>>>>> "rif" == rif <[EMAIL PROTECTED]> writes:
rif> (declaim (optimize (speed 3) (debug 0) (safety 0)))
rif> (defun copy-frame (frame n)
rif> (declare (type (simple-array double-float) frame))
rif> (declare (type fixnum n))
rif> (let ((new-frame (make-array n :element-type 'double-float)))
rif> (dotimes (i n)
rif> (declare (type fixnum i))
rif> (setf (aref new-frame i) (aref frame i)))
rif> new-frame))
rif> (defvar frame (make-array 10 :element-type 'double-float))
rif> I don't know why this is happening, I would have thought that the fact
rif> that frame is a parameter to copy-frame meant that the type
rif> declaration in copy-frame applied to what was passed in, not to the
rif> def var'd frame, and it also seems to me that the the defvar gives a
rif> frame which does match the type declaration. So generally, I'm still
The value of frame matches, but the compiler doesn't know that. You'd
have to declaim frame appropriately.
rif> not clear why this is happening, but it seems I can fix it by not
rif> having a defvar in my package that matches the parameter names of
rif> functions. Any explanations?
I think that's the explanation. The parameter is really referring to
the special variable. It's explained somewhere in the CLHS. (I
always get confused by this, though, so I ALWAYS put *'s around my
special vars.)
Ray