[racket-dev] #true and #false
[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. Of course, there would be a parameter to pick the
traditional format in any case, and we won't change the printer used
for R5RS or R6RS.
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.
Using `#t' and `#f' in the teaching languages would avoid the problem,
but those forms seem awfully terse. We'd like to try `#true' and
`#false', instead. Then, to keep the HtDP and full Racket languages in
sync as much as possible, we would like to add `#true' and `#false' to
Racket. Along the same lines, consistent printing would be ideal.
I'd like to switch to `#true' and `#false' because I often fail to look
carefully enough to distinguish `#t' and `#f'. Just this morning, I
tried out my prototype reader change in the REPL:
Welcome to Racket v5.0.1.7.
> #true
#t
> #false
#t
That looked right to me. Of course, new cases in the reader test suite
immediately flagged the bug, but I was amused that "testing" in a REPL
didn't make me see the problem in the first place.