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

2010-10-09 Thread Matthew Flatt
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'.

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


[racket-dev] DrRacket Extension crashes when allocating memory

2010-10-09 Thread Justin Phillips
I'm writing an extension for Mac OS X using the CoreMIDI library. I can send
MIDI data into DrRacket by registering a callback. In my callback I need to
allocate memory with malloc. I have written the code in XCode to verify that
it works. When I compile with 3m for DrRacket it crashes DrRacket when it is
used. Any ideas?? CoreMIDI assigns a high priority thread to handle the
processing. It is definitely the malloc line that breaks. When I remove it,
the extension works. Of course I need the malloc line for the data to be
correct. Any help will be greatly appreciated. Thank you
-Justin
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

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

2010-10-09 Thread Eli Barzilay
Yesterday, Matthew Flatt wrote:
 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.

The problem is that the number of hooks that you need to remember to
control IO keeps changing (and usually grows), making it hard to find.

 (Actually, `s-exp-fasl' and `fasl-s-exp' are better choices when
 size matters.)

(I should have added: in a way that is also human readable and
editable.  The fasl formats are great for saving space and read time
(which is why I used that well before the fasl interface...), but I
use them only when the data is large enough to justify it -- otherwise
the editable format is a bigger win.)


 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'.

Sounds like this is a core question then: I'd like to keep coding with
#t and #f, so I prefer seeing them in ~.s messages.  Two points that
I see as emphasizing this: (a) it's a change that is motivated by the
teaching languages, (b) it contradics the gradual shift to avoiding
verbosity when possible (which is a direction that I very much like,
and I get the feeling that I'm not alone).

-- 
  ((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