[racket-dev] Transparent Structures in XML Library

From: Doug Williams (m.douglas.williams at gmail.com)
Date: Mon Oct 3 16:57:58 EDT 2011

Maybe this is general question or observation, but I specifically have the
problem with the xml module in Racket. All of the structures defined in
collects/xml/private/structures.rkt are transparent. Most of my xml files
are hundreds of thousands of bytes to tens of megabytes in size. Needless to
say, if any of these make it to a display statement, it isn't pretty.
Actually, since the structures also include location information, the result
can be (is) larger than the actual XML was.

I don't think they are transparent for any reason other than some east of
debugging - and for large xml structures it is actually (in my opinion)
detrimental to debugging. And, it doesn't help by adding an equality test
because of the location information - equal? is pretty much identical to (an
extremely slow) eq? in this case.

Could we get rid of the #:transparent option on those structures? Or, if
they are really there for a reason, at least add a prop:custom-write that
limits the potential output from printing an instance?

This is the only case where I have run into the 'problem'. But, there may be
other places it exists.

I am also guilty of using transparent structures sometimes, so I can't be
too critical here.

Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20111003/9fd53263/attachment.html>

Posted on the dev mailing list.