<div dir="ltr">Thanks for the illuminating and correct answer. 'eval-when'  fixed the issue. The code is non-portablish it was coded for Allegro as a majority platform and contained some SBCL support.  <br></div><div class="gmail_extra">

<br><br><div class="gmail_quote">On Mon, Jun 23, 2014 at 9:35 PM, Gary Byers <span dir="ltr"><<a href="mailto:gb@clozure.com" target="_blank">gb@clozure.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

It's hard to say anything useful without knowing when the error occurs.<br>
Did it occur during compilation, after loading a compiled file, or<br>
at some other time ?<br>
<br>
>From what I can tell, you're getting the error while trying to make<br>
a POINT structure whose OWNER slot is NIL but is declared to be a<br>
CLUSTER, and this happens in an environment in which the CLUSTER<br>
type isn't yet defined.  What do you think should happen in this<br>
case ?  What do you think after you read section 3.2.3.1.1 of CLHS ?<br>
<br>
If I'm guessing correctly about what's happening, then your code<br>
is wrong (or at least non-portable) in a couple of ways:<br>
<br>
You can more portably ensure that the type CLUSTER is defined<br>
later in the compilation process by surrounding the CLUSTER definition<br>
with EVAL-WHEN:<br>
<br>
(eval-when (:compile-toplevel :load-toplevel :execute)<br>
  (defstruct cluster ...))<br>
<br>
This would at least ensure that the type CLUSTER is defined when you<br>
try to try to make a POINT whose OWNER is NIL.  What happens when you<br>
do the latter (violate a type declaration) is undefined; I'm a little<br>
surprised if CCL would check that declaration if (SPEED 3) (SAFETY 1)<br>
is in effect, but I don't know if it indeed was in effect.<div class=""><br>
<br>
<br>
On Mon, 23 Jun 2014, Michael Maul wrote:<br>
<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">
Any ideas on the code below causing 'Unknown Type Specifier' condition.<br>
Works fine on SBCL however CCL throws condition. I think it may relate to<br>
the :type specification referencing cluster in the point struct definition.<br>
As if I eval just the cluster struct then reload the module the condition is<br>
not thown.<br>
<br>
Unknown type specifier: HJS.LEARN.K-MEANS:CLUSTER<br></div>
?? [Condition of type SIMPLE-ERROR]<br>
<br>
<br>
Backtrace:<br>
? 0: (CCL::%%TYPEP NIL #<UNKNOWN-CTYPE HJS.LEARN.K-MEANS:CLUSTER>)<br>
? 1: (TYPEP NIL HJS.LEARN.K-MEANS:CLUSTER NIL)<div class=""><br>
<br>
<br>
;; Code Fragment<br>
(declaim (optimize (speed 3) (debug 1) (safety 1)))<br>
;;;; data and type definition<br>
(deftype id () 'fixnum)<br>
<br>
<br>
(defstruct (cluster (:conc-name c-)<br></div>
???????????????????<br>
??????????????????? (:constructor %make-cluster (id center))<br>
???????????????????<br>
??????????????????? (:copier copy-cluster))<br>
? (id -1 :type id)<br>
? (center #.(make-dvec 0) :type dvec)<br>
? (old-center #.(make-dvec 0) :type dvec)<br>
? (size 0 :type fixnum)<br>
? (points nil :type list)<br>
? )<br>
<br>
<br>
(defun make-cluster (id center)<br>
? (let ((center (coerce center 'dvec)))<br>
??? (check-type id id)<br>
??? (check-type center dvec)<br>
??? (let ((result (%make-cluster id (copy-seq center))))<br>
????? (setf (c-old-center result) (copy-seq center))<br>
????? result)))<div class=""><br>
<br>
(defstruct (point (:conc-name p-)<br></div>
????????????????? (:constructor %make-point (id pos))<br>
????????????????? (:copier copy-point))<br>
? (id -1 :type id)<br>
? (pos #.(make-dvec 0) :type dvec)<br>
? (owner nil :type cluster)??????????????????????<u></u>???? ;<br>
? )<br>
...<br>
<br>
<br>
<br>
</blockquote>
</blockquote></div><br></div>