[racket-dev] #true and #false

2010-10-08 Thread Matthew Flatt
[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.

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] #true and #false

2010-10-08 Thread Robby Findler
Sounds great to me, fwiw.

Robby

On Fri, Oct 8, 2010 at 8:12 PM, Matthew Flatt mfl...@cs.utah.edu 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. 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.

 _
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

Re: [racket-dev] #true and #false

2010-10-08 Thread Eli Barzilay
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!
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] #true and #false

2010-10-08 Thread Matthew Flatt
At Fri, 08 Oct 2010 23:10:05 -0400, David Van Horn wrote:
 On 10/8/10 9:12 PM, Matthew Flatt wrote:
  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.
 
 What about '(empty)?  Seems like the same issue.

Yes, so we are also looking at how to move away from `empty'.

The answer isn't `#empty' --- at least not without breaking the
correspondence between an expression E and `eval' of a `quote'd E. For
example, we would want `#empty' by itself to mean the empty list, and
quoting `#empty' should also mean the empty list, but `eval'ing the
empty list should be an empty application, not the empty list.

Maybe we have to use '() for the empty list, even in the teaching
languages.

_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] #true and #false

2010-10-08 Thread Eli Barzilay
Two minutes ago, Matthew Flatt wrote:
 At Fri, 8 Oct 2010 23:11:21 -0400, Eli Barzilay wrote:
  
  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?
 
 It's an expression issue, not a printing issue. We tell students
 that `true' and `false' are literals, and we later tell them that
 `quote' can be used to form lists of literals, and so they try to
 write the above.

Ah, OK.  (Just to mention the other kind of course -- in my class I
explicitly make a point about the difference between the common
`true'/`false' keywords and racket's identifiers  literals.  I think
that most students still miss that point, and get confused over the
quoted identifiers and using them in a `let'.)

In any case, this seems to me like it weakens the case for the longer
names being used globally rather than only in the teaching languages.
(But I'm still not objecting, except for the same `write' point I
made.)

-- 
  ((lambda (x) (x x)) (lambda (x) (x x)))  Eli Barzilay:
http://barzilay.org/   Maze is Life!
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev