[plt-scheme] structure inspectors
At Mon, 22 May 2006 08:11:01 -0400 (EDT), Nicholas Chubrich wrote:
> I would like to examine a built-in structure, specifically the-style-list
> in the MrEd editor toolkit. This means dealing with inspectors. I saw in
> the list archive that you could use a procedure called make-->vector to
> bypass inspectors, but I cannot get this to work, because I am unable to
> come up with a struct type descriptor. It should be struct:style-list%,
> but this ends up being an unbound value in the environment.
> Any suggestions? I would like to be able to look at style lists
> in a single glance, without having to access each field individually.
A style list is an object in the sense of `(lib "class.ss")'. So, it's
a structure, but it doesn't correspond to a simple `define-struct'.
You could get a sufficiently powerful inspector by swapping the
inspector before `(lib "mred.ss" "mred")' is loaded, which means using
the -Z command-line argument. But this is surely not the direction you
want to go. For one thing, the object mostly just contains a pointer to
opaque "primitive" data, combined with the methods to extract parts of
the data. Even if the native data was inspectable, the implementation
of a style list is too complicated for the raw object content to be
informative.
In short, I think the only useful thing for a `style-list%' object is
an explicit print function that uses the existing methods.
Matthew