[plt-scheme] Printing Structures without using custom-write

From: Robby Findler (robby at cs.uchicago.edu)
Date: Wed Oct 10 16:21:42 EDT 2007

I'm not sure what the exact form it would take. My reasoning goes
something like this: "mzscheme has some code that does what you want
and if it could be exposed to you so you could reuse it, would that
work?"

Robby

On 10/10/07, Sam TH <samth at ccs.neu.edu> wrote:
> On 10/10/07, Robby Findler <robby at cs.uchicago.edu> wrote:
> > Or maybe a third option in thd new-things-from-mzscheme department
> > would be to expose the struct-specific default printer, to help you
> > break the infinite loop? Does that help?
>
> I'm not positive about what you mean by 'struct-specific default
> printer'.  Do you mean the default printer for a specific struct?  Or
> the default printer for all structs?  Or something else?
>
> All of these solutions would work for me.
>
> sam th
>
> >
> > Robby
> >
> > On 10/10/07, Sam TH <samth at ccs.neu.edu> wrote:
> > > On 10/10/07, Eli Barzilay <eli at barzilay.org> wrote:
> > > > On Oct 10, Sam TH wrote:
> > > > > On 10/10/07, Eli Barzilay <eli at barzilay.org> wrote:
> > > > > > On Oct 10, Sam TH wrote:
> > > > > > > I have this already, because it would be very hard to some things
> > > > > > > otherwise.  But it's not a total solution - you can't debug your write
> > > > > > > handler with printf, because you immediately get an infinite loop.
> > > > > > >
> > > > > > > Also, it requires having all your structures defined with a macro that
> > > > > > > expands to define-struct, which is the case for me, but limits the
> > > > > > > applicability of the technique.
> > > > > >
> > > > > > Can't you have a parameter that conrols your own output, and based on
> > > > > > that your printers will spit out the nice output or something that
> > > > > > looks like the standard output?
> > > > >
> > > > > Yes, but then you have to re-implement the standard printer.
> > > >
> > > > ...which is a one liner, so it shouldn't be a problem in practice.
> > >
> > > This is false.  It's one line per structure, which is significant for
> > > any complex set of structs.
> > >
> > > > Conceptually, there may be future extensions to struct printing that
> > > > you'll want to have -- but even with that I think that if you want
> > > > your own output then you should go all the way with that.
> > >
> > > I don't even understand what you're suggesting here.
> > >
> > > Perhaps I didn't make my point clearly enough in my original message.
> > > Mzscheme doesn't currently provide a way to print structs without
> > > using custom-write procedures.  Before I implement such a way, I'm
> > > interested in people's feelings on the design of such a feature.
> > >
> > > Thanks,
> > > --
> > > sam th
> > > samth at ccs.neu.edu
> > >
> >
>
>
> --
> sam th
> samth at ccs.neu.edu
>


Posted on the users mailing list.