[plt-scheme] Student parsing problem

From: Stephen Bloch (sbloch at adelphi.edu)
Date: Wed Jun 3 11:59:59 EDT 2009

On Jun 3, 2009, at 11:40 AM, Eli Barzilay wrote:

> On Jun  3, Felix Klock's PLT scheme proxy wrote:
>> [...]
>
> I find it hard to justify either comments or whitespace after quotes
> etc even in "hacker mode" -- the only reason would be to conveniently
> comment out an expression, which is redundant when there's `#;' now.

Eli, you're quite right for comments or whitespace immediately after  
an INTENTIONAL quote.  But it's really easy to type a quote or a  
backquote accidentally and not notice it because it's only a few  
pixels, and possibly many lines away from the code you're paying  
attention to.  As I understand it, the student problems that  
triggered this thread were exactly such typoes.

I'm reminded of a similar bug I ran into in college: I was writing in  
Pascal, compiling and running on an IBM mainframe, and about twenty  
lines of my program were mysteriously not happening.  It turned out  
that I had a comment whose closing delimiter was in character  
positions 73-74 of the line, and since the compiler had originally  
been written to work with punch cards, it reserved character  
positions 73-80 for card serial numbers.  So it blithely kept  
commenting for the next twenty lines until it saw a close-comment  
delimiter in the part of the line that it liked.

> But:
>
>> #;; This is our great code.
>> ;;; ...
>
> I *do* find mixing comments useful -- either `;' in a `#;' or the
> other way.  For example:

I've been using
#|
(define (function-for-lon numbers)
    ; numbers        lon
    (cond [(empty? numbers) ...]
               [(cons? numbers)
                ; numbers                nelon
                ; (first numbers)      number
                ; (rest numbers)      lon
                ; (function-for-lon (rest numbers))    whatever
    ...
    )
|#

in my textbook.  The idea is that you can copy-and-paste the stuff  
between the #|...|# every time you want to write a new function on  
lists of numbers, and it comes complete with commented-out inventory.

Now that I know about #;, I think I have some rewriting to do....



Stephen Bloch
sbloch at adelphi.edu



Posted on the users mailing list.