[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how to subtype a handle by contents of handle

Ok, maybe I'm just being stupid about how to do this, or maybe it's just
an inherently bad idea, but for some time now, I've been considering
writing a macro that do some fancy type-like stuff for handle-based data

Basically, I want to store a type-byte in the first byte of a handle, so I
want something like (def-datatype foo) to:
   (defun foop (x)
      (and (handlep x)
           (>= (#_GetHandleSize x) 1)
           (= (%hget-byte x) <auto-increment-counter>)))

    (deftype foo '(satisfies foop))

Now I realize that there is a chance that some arbitrary handle [say a
PICT] would be misconstrued as a foo, but I'm not real worried about it. 
I'm more interested in a good way to type-check among my own data-types.

My first attempts at writing def-datatype are failing miserably.

Any suggestions?

-- "TANSTAAFL"  Rich lynch@ils.nwu.edu