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

From: Eli Barzilay (eli at barzilay.org)
Date: Wed Jun 3 14:41:48 EDT 2009

On Jun  3, John Clements wrote:
> 
> 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.

Yes, there would be such situations -- many of them, and Scheme being
Scheme, you don't get any way of doing this.  You could think about a
macro system where some code expands to a `special-comment' value, and
hook the macro expander to discard such values -- but that's a
borderline confusion of the reader level and the macro level.  You
could just the same imagine a macro system that allows expanding to a
single double quote, forcing the expander to reparse the code... and
at this point you need to stick your head just a little higher (or
maybe lower, depending on your POV) and you'll be able to see that
you're almost in TeX world.

IOW, such things break exactly the point where Scheme draws a lot of
power from: the separation of concrete syntax and AST manipulation.
(This is a point that Shriram describes nicely at the beginning of
PLAI.)  This power comes from the *separation* of the two worlds,
whereas technically TeX gives you more power which results in
...uh... TeX.

[And BTW, there *is* some point in being able to express things close
to that -- I ran into this with the scribble reader, so this is still
in the concrete parsing world.]

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.