-(deftype-method translate-from-alien
- proxy (type-spec location &optional weak-ref)
- `(let ((location ,location))
- (unless (null-pointer-p location)
- (ensure-proxy-instance ',type-spec location ,weak-ref))))
-
-(deftype-method translate-to-alien
- proxy (type-spec instance &optional weak-ref)
- (if weak-ref
- `(proxy-location ,instance)
- (let ((copy (proxy-class-copy (find-class type-spec))))
- (if (symbolp copy)
- `(,copy ',type-spec (proxy-location ,instance))
- `(funcall ',copy ',type-spec (proxy-location ,instance))))))
-
-(deftype-method unreference-alien proxy (type-spec location)
- (let ((free (proxy-class-free (find-class type-spec))))
- (if (symbolp free)
- `(,free ',type-spec ,location)
- `(funcall ',free ',type-spec ,location))))
-
-;; (defun proxy-instance-size (proxy)
-;; (proxy-class-size (class-of proxy)))