syntax of commenting (was: Re: [plt-scheme] Student parsing problem)

From: John Clements (clements at brinckerhoff.org)
Date: Wed Jun 3 14:28:09 EDT 2009

On Jun 3, 2009, at 11:11 AM, Anthony Cowley wrote:

> On Wed, Jun 3, 2009 at 1:52 PM, Eli Barzilay<eli at barzilay.org> wrote:
>> 1. We want a convenient way to comment the next sexpr, even when not
>>   in an expression position.
>>
>> 2. Solution: `#;' does that.
>>
>> 3. Just like it's convenient to comment out the next *single* sexpr,
>>   it can be convenient to comment out the next two sexprs.
>
> My opinion is that #; as a way to comment out an expression is
> justifiable because it's easier to toggle than #| |# *and* it is
> syntactically adjacent to the expression it affects (this is a
> not-so-subtle callback to the origins of this thread).

Thinking about this more, I think what I'd like more than stacked #:#:  
would just be a parenthesized comment-out form, e.g.:

(COMMENT
(big
  sexpression
  one)

(big
  sexpression
  two))


You could pretty much get what you want by just defining a macro that  
discards its argument, though I'm sure there would be situations where  
this wouldn't behave the same as the reader macro. Also, you probably  
want everyone using the same convention.

As to the convenience of this form: You can use C-c C-e to strip a  
pair of matched parens, so commenting it back in doesn't require  
complex machinations. I agree that this isn't quite as convenient as  
the insertion and removal of a single semicolon. If this became an  
accepted form, you could also define an XCOMMENT macro that *doesn't*  
comment out its argument (and in fact splices them into the parent  
sexp) so that you could do the semicolon trick with an X instead.

In short: I claim that something like this would greatly simplify the  
task of determining whether a particular expression is commented out  
or not.  Naturally, so would simply forbidding the double #; .


Namby-pambily yours,

John

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2484 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20090603/438be450/attachment.p7s>

Posted on the users mailing list.