[racket-dev] #true and #false

From: Eli Barzilay (eli at barzilay.org)
Date: Fri Oct 8 23:11:21 EDT 2010

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.

(As for `print' -- seems fine to use the long forms, and I don't have
any opinion on `display' (maybe in the name of "just show some roughly
readable stuff" it should use the long forms too).)


> This proposal originates with the need to fix a problem in the HtDP
> teaching languages. The HtDP teaching languages currently use `true'
> and `false' for true and false, and the HtDP languages are configured
> to print booleans as `true' and `false'. That doesn't work with quoted
> lists. For example,
> 
>   '(true false) 
> 
> is a list of symbols, not a list of booleans.

BTW, wasn't the whole sophisticated quoted printout part of a solution
to this, so that those true/false would not print out as quoted?

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the dev mailing list.