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


My concern about having EQUAL descend structures and arrays is that
they are much more likely than lists to be circular.

Typically, a list is created after its elements, whereas a structure
or array is created before its elements.  (*Typically*, not always!)

As a rule of thumb, I'd bet that less than .0001% of all lists are
circular, and that less than 1% of all arrays are circular, but only
that less than 30% of all structures are circular.  

I think there is a tendancy to include fields like CHILDREN and
PARENTS, or PREVIOUS and NEXT, etc. in structures, which are thus
almost guaranteed to be circular.  In fact, when I'm creating circular
data I tend to think first of using structures, because I am then less
likely to get screwed by EQUAL, etc.

I don't have time now to think through the algorithmic details, but
maybe DEFSTRUCT could let you specify that specific slots are
"back-pointers".  Then EQUAL could record them when descending and
perform a more sophisticated comparison than it would for all other
pointers.   Thus you would only pay at runtime for the specific
complications you did introduce, not those you might have.  Making
backpointers explicit might help human readability as well.

[As something of an aside, I think you should also be able to specify
 *print-level* and *print-length* for specific structure fields, to
 avoid losing on some fields when trying to see others.]