I could. But then everyone who wants to use large xml file in places where they potentially print would have to do the same thing. And, remember that 'large' in this case is anything other than a rather small XML file.<br>
<br><div class="gmail_quote">On Mon, Oct 3, 2011 at 5:49 PM, Matthias Felleisen <span dir="ltr"><<a href="mailto:matthias@ccs.neu.edu">matthias@ccs.neu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div style="word-wrap:break-word"><div><br></div><div>I understand. Specifics: </div><br><div><div class="im"><div>On Oct 3, 2011, at 7:45 PM, Doug Williams wrote:</div><br><blockquote type="cite">Basically, I'm just suggesting that the xml package have sensible printing of its structures. I can't imagine any case where you really want the default printing of recursive structures of that complexity and potential size to be the visible behavior.<br>
</blockquote><div><br></div><div><br></div></div><div>When you write very small XML pieces of data (say something that fits on 80 lines, 80 chars each), this kind of printing is just fine. </div><div class="im"><div><br></div>
<br><blockquote type="cite">Where it was annoying me was in my inference engine when I was doing inference across very large xml documents. I have a trace feature in the inference engine to trace assertions that is very useful for debugging rules. You can imagine the output when I turned it on the first time with one of the large xml documents. Literally, one assertion was 100+ pages.<br>
<br>I've pushed a new version of the inference engine that uses ~.s throughout. So, at least it prints it reasonable. But, it is still continually walking the structures and building a huge string (at least 10s of megabytes each at the highest levels). And, it has to do that for every assertion in a trace.<br>
</blockquote><div><br></div><div><br></div></div><div>I am proposing an alternative approach. Write an adapter module for the XML library that does NOT bother to traverse the structure to create some huge and useless string. </div>
<div><br></div><div>Is this possible for your world? </div><div><br></div><font color="#888888"><div>-- Matthias</div></font><div class="im"><div><br></div><div><br></div><div><br></div><br><blockquote type="cite">At least I have a large memory machine with plenty of memory (and, thanks to you guys, a 64-bit windows version), so it does run. It's just annoying.<br>
</blockquote><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><br><blockquote type="cite"><br><div class="gmail_quote">On Mon, Oct 3, 2011 at 4:34 PM, Matthias Felleisen <span dir="ltr"><<a href="mailto:matthias@ccs.neu.edu" target="_blank">matthias@ccs.neu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Doug, does this concrete example concerning printing help:<br>
<br>
#lang racket/load<br>
<br>
(module a racket/base<br>
(struct xml (bar) #:transparent)<br>
<br>
(define x (xml "bar"))<br>
(displayln x)<br>
<br>
(provide (struct-out xml) x))<br>
<br>
(module b racket/base<br>
(require 'a)<br>
<br>
(struct my xml () #:property prop:custom-write (lambda (x p z) (displayln "<my xml>" p)))<br>
<br>
(define y (my "bar"))<br>
<br>
(displayln y))<br>
<br>
(require 'b)<br>
<br>
<br>
</blockquote></div><br>
</blockquote></div></div><br></div></blockquote></div><br>