[plt-dev] Re: [plt-bug] all/10895: quasiquote printing is buggy, confusing

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Mon May 10 13:46:52 EDT 2010

On Mon, May 10, 2010 at 12:44 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
>  It seems there should be a way to make
>> custom structs print as if they should be quoted, but that shouldn't
>> be the default.
>
> I'm not sure about the default.

Here's the results of surveying uses of `prop:custom-write' in collects:

3 that shouldn't be quoted (1 of them by me)
3 that are not expressions, but are printed with () anyway, so should
probably be made unreadable (all by me)
9 unreadable, so it shouldn't be quoted
- 1 of these should be changed to a non-quoted form, probably (`set')
1 that has a pseudo-self-quoting syntax (srfi/63)

This suggests that no one is writing custom printers that should be
quoted.  Further, since there's no mechanism for structs to
automatically extend the read syntax and the behavior of `quote', only
very rarely will structs be usefully printed in a quoted form.  Both
of these pieces of evidence suggest to me that quoting is the wrong
default.


> > Finally, one more things I noticed when looking at the custom-write
> > docs: The following expression at the DrRacket repl errors with a
> > strange error message:
> >
> > > #0='#(#0#)
> > . read: #..= expressions not allowed in read-syntax mode
> >
> > This used to be allowed, right?
>
> This was allowed prior to v4.0, but not since v4.0.

The error message is rather confusing - why does it mention `read-syntax'?
--
sam th
samth at ccs.neu.edu


Posted on the dev mailing list.