anchor.diff:       (uses-method-p :initarg :uses-method-p :reader s-uses-method-p))))
   
   (defmethod v-type-of ((gss gl-struct-slot))
  -  (type-spec->type (s-type gss)))
  +  (if (eq (s-type gss) :array)
  +      (type-spec->type (list (s-element-type gss) (s-dimensions gss)))
  +      (type-spec->type (s-type gss))))
   
   (defmethod s-arrayp ((object gl-struct-slot))
     (eq (s-type object) :array))
  
positive.code:                          ',foreign-struct-name
                           ',(s-name slot))))
  
  (defun+ make-array-slot-getter (get-ptr slot type-name foreign-struct-name)
    `(,(s-def slot) ,(s-reader slot)
       ,(s-slot-args slot `((wrapped-object ,type-name)))
       (cepl.c-arrays::make-c-array-from-pointer
        ',(s-dimensions slot) ',(s-element-type slot)
        (foreign-slot-pointer (,get-ptr wrapped-object)
                              ',foreign-struct-name
                              ',(s-name slot)))))
  
  (defun+ make-slot-setter (get-ptr slot type-name foreign-struct-name)
    (when (s-writer slot)
      (cond
        ((or (member (s-type slot) cffi:*built-in-foreign-types*)
             (assoc (s-type slot) cffi::*extra-primitive-types*))
         (make-eprim-slot-setter get-ptr slot type-name foreign-struct-name))
        ((not (s-arrayp slot)) (make-t-slot-setter slot type-name))
        ((s-arrayp slot) (make-array-slot-setter slot type-name))
        (t (error "Dont know what to do with slot ~a" slot)))))
  
  (defun+ make-eprim-slot-setter (get-ptr slot type-name foreign-struct-name)
    `(,(s-def slot) (setf ,(s-writer slot))
       ,(s-slot-args slot `(value (wrapped-object ,type-name)))
       (setf (mem-ref (foreign-slot-pointer (,get-ptr wrapped-object)
  
negative.code:       (defmethod get-typed-to-foreign ((type-name (eql ',name)))
          #',to))))
  
  (defun+ format-slot-for-cstruct (slot layout)
    (if (s-arrayp slot)
        (format-array-slot-for-cstruct slot layout)
        `(,(s-name slot)
           ,(s-type slot)
           ,@(when layout `(:offset ,(layout-base-offset layout))))))
  
  (defun+ format-array-slot-for-cstruct (slot layout)
    (when (> (length (s-dimensions slot)) 1)
      (error "Cannot currently support multi dimensional arrays"))
    ;; As we cant encode stride in defcstruct we instead make a byte array of
    ;; the correct size and rely on c-array to handle the stride correctly.
    (if layout
        `(,(s-name slot)
           (:array :uint8 ,(layout-machine-unit-size layout))
           :offset ,(layout-base-offset layout))
        `(,(s-name slot)
           (:array ,(s-element-type slot) ,(reduce #'* (s-dimensions slot))))))
  
  ;;{TODO} should be setting fields here
  (defun+ make-make-struct (constructor-name
                            wrapper-constructor-name
                            awrap-type-name
                            slots)
    (let ((vars (loop :for s :in slots :collect (s-name s))))
      `(defun+ ,constructor-name ,(cons '&key vars)
         (let ((result (,wrapper-constructor-name
                        (foreign-alloc ',awrap-type-name))))
           ,@(loop :for s :in slots :for v :in vars :collect
                `(when ,v (setf (,(s-writer s) result) ,v)))
           result))))
  
  ;;------------------------------------------------------------
  
  (defun+ make-slot-getter (get-ptr slot type-name foreign-struct-name layout)
    (when (s-reader slot)
      (cond
        ((not (s-arrayp slot)) (make-t-slot-getter
                                get-ptr slot type-name foreign-struct-name))
        ((s-arrayp slot) (make-array-slot-getter
                          get-ptr slot type-name foreign-struct-name layout))
        (t (error "Dont know what to do with slot ~a" slot)))))
  
  (defun+ make-t-slot-getter (get-ptr slot type-name foreign-struct-name)
  