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

Printing of displaced/shared arrays

It seems to me the "problem" of loss of sharing when you print displaced
arrays and try to read them back in is classical. Normal printing of any
data structure that shares non-atomic parts with itself or anything else,
followed by reading it back in, causes the sharing to be lost. We've
accepted that fact since day one and seeing it crop up with displaced
arrays shouldn't upset us. We should expect that when an array is printed
out all information about its structure (dimensions) and contents (elements)
should be included in the printing, except that information about shared
structure will be lost if the normal printer is used. Some really smart
printer might be able to recognize shared structure and arrange to preserve
it on reading back in, but normally we shouldn't expect such a printer to
be available for all possible cases of sharing that can occur.

If a program has a crazy-quilt of displaced arrays sharing structure,
the programmer shouldn't expect to be able to print out the structure
and later read it back in. But the programmer should be able to expect
to be able to print out the structure for purpose of eyeballing it
during debugging, and not have critical information lost, such as
which axis are of length zero.

Thus the proposal to use #.(MAKE-ARRAY ...) or whatever seems reasonable
in cases where normal print representation loses critical information.