Re: nested comments (please correct lexical scope)
Bradd W. Szonye 10 Jan 2005 17:03 UTC
Paul Schlie wrote:
>>> Personally I believe this is not a good idea, it's neither
>>> syntactically consistent with scheme, nor visually expected: more
>>> simply and consistently I would expect a #; comment to lexically
>>> remove the expression/token it's been lexically prepended to,
>>> nothing else. (including white-space). i.e.:
>>>
>>> ... (a #; b #;c) => (a b)
Bradd wrote:
>> Why? That's a token comment, not an s-expression comment, and it
>> seems to serve no useful purpose (unless you intend to support
>> token-pasting a la (a#; b) => (ab), which is IMO a very bad idea).
> Huh? arguably a# is a symbol, followed by a ; comment rest of line.
In your example above, it looked to me like you were using #; to remove
the whitespace token. Based on your later comments, I now see that
you're just talking about what it means to "prepend" a token -- i.e.,
that the sexp-comment is prepended to A in "#;a" but not in "#; a" where
whitespace separates the two tokens.
I see where you're coming from with that, but I disagree. I generally
don't think it's a good idea to differentiate syntax based on whitespace
like that.
>> I do agree that it'd be somewhat more intuitive if #; worked more
>> like QUOTE, with (#;#;foo bar) being equivalent to (#;(#;foo) bar)
>> rather than (#;foo #;bar). However, this idea of commenting tokens
>> instead of s-expressions seems like a very bad idea.
> Huh?
Sorry, I mashed three ideas together there:
1. I don't think it's a good idea for (#;#;a b c) => (c).
2. I would prefer (#;#;a b c) => (b c), analogous to (''a b c).
3. I don't like the suggestion that (#; a) => (a) because of the space.
To defend my #1: While I understand the "comment out next sexp"
explanation, my mind sees "A" as the next sexp for /both/ comment tokens
in (#;#;a b c), thus making it equivalent to (#;a b c) => (b c).
--
Bradd W. Szonye
http://www.szonye.com/bradd