[racket-dev] #true and #false

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sat Oct 9 09:55:29 EDT 2010

At Fri, 8 Oct 2010 23:11:21 -0400, Eli Barzilay wrote:
> Two hours ago, Matthew Flatt wrote:
> > [Re-sending; an earlier post of this message seems to be delayed.]
> > 
> > What if the default printing format for true and false values in
> > Racket changed from `#t' and `#f' to `#true' and `#false'?
> > 
> > The forms `#t', `#T', `#true', `#f', `#F', and `#false' would all be
> > accepted as inputs forms. We could conceivably limit the change to
> > `print' output and not change `write' or `display' output, but let's
> > say for now that the proposal is to change the default for all
> > output modes in Racket. [...]
> 
> I'd prefer it if at least `write' keeps it as "#t".  IMO `write' as a
> quick way to serialize some data to a file in a way that is also
> readable is a very big win, and having a single character (in addition
> to the obligatory "#" syntax marker) used for booleans makes it fine
> in most cases, even up to pretty big files.  I can see how making it
> much longer will encourage using some bad home-cooked serializations
> to avoid the extra size -- and that would be bad.

I agree that serialization is a common use of `write', but if size is
an issue, it seems like setting the `print-boolean-long-form' parameter
would be easier than cooking a new serialization format. (Actually,
`s-exp->fasl' and `fasl->s-exp' are better choices when size matters.)

An even more common use of `write', I think, is to print code. If we
switch to `#true' and `#false' as the default forms of the constants, I
think we want all those uses of "~.s" that you recently fixed up to
print with `#true' and `#false'.



Posted on the dev mailing list.