Re: nested comments (please correct lexical scope) Paul Schlie (09 Jan 2005 22:35 UTC)
Re: nested comments (please correct lexical scope) Robby Findler (09 Jan 2005 22:39 UTC)
Re: nested comments (please correct lexical scope) Paul Schlie (09 Jan 2005 22:44 UTC)
Re: nested comments (please correct lexical scope) Robby Findler (09 Jan 2005 22:46 UTC)
Re: nested comments (please correct lexical scope) Paul Schlie (09 Jan 2005 22:54 UTC)
Re: nested comments (please correct lexical scope) Robby Findler (10 Jan 2005 00:59 UTC)
Re: nested comments (please correct lexical scope) Paul Schlie (10 Jan 2005 01:16 UTC)
Re: nested comments (please correct lexical scope) Paul Schlie (10 Jan 2005 01:56 UTC)
Re: nested comments (please correct lexical scope) Paul Schlie (10 Jan 2005 02:27 UTC)
Re: nested comments (please correct lexical scope) Robby Findler (10 Jan 2005 02:43 UTC)
Re: nested comments (please correct lexical scope) Bradd W. Szonye (10 Jan 2005 00:05 UTC)
Re: nested comments (please correct lexical scope) Paul Schlie (10 Jan 2005 01:02 UTC)
Re: nested comments (please correct lexical scope) Bradd W. Szonye (10 Jan 2005 17:03 UTC)
Re: nested comments (please correct lexical scope) Paul Schlie (10 Jan 2005 20:23 UTC)
Re: nested comments (please correct lexical scope) Bradd W. Szonye (10 Jan 2005 20:59 UTC)
Re: nested comments (please correct lexical scope) Paul Schlie (10 Jan 2005 21:13 UTC)
Re: nested comments (please correct lexical scope) Paul Schlie (10 Jan 2005 22:15 UTC)
Re: nested comments (please correct lexical scope) Paul Schlie (10 Jan 2005 22:20 UTC)
Re: nested comments (please correct lexical scope) Paul Schlie (10 Jan 2005 23:07 UTC)
Re: nested comments (please correct lexical scope) Paul Schlie (11 Jan 2005 14:20 UTC)

Re: nested comments (please correct lexical scope) Paul Schlie 09 Jan 2005 22:34 UTC

> Robby Findler writes:
>> David Van Horn writes:
>> What does the following evaluate to?
>>
>>    (list 'x #;#;'y 'z)
>
> FWIW, mzscheme and chez scheme do the same thing:
> ...
> > (list 'x #;#;'y 'z)
> (x)
>
> Taylor Campbell writes:
> MzScheme & Chez, as Robby Findler demonstrated, both give the list (X).
> This is correct.  (SISC & Chicken do, too.)  The reason is that #;
> ignores the single next following S-expression and allows the reader to
> continue on after that.  In the string "#;'y 'z", the #; comments out
> the 'Y part, leaving the 'Z part.  Since a #; precedes that string in
> your example, the 'Z part is ignored, too, so the whole thing is read
> as (LIST (QUOTE X)), which evaluates to the list (X).
>
> This is an excellent & possibly initially confusing example (though the
> explanation is simple & straightforward), so I'll add it to the SRFI
> document.  I'll also add another example of nested comments, too:
>
>   (list 'a #;(list 'b #;'c 'd) 'e)    ==>  (LIST (QUOTE A) (QUOTE E))
>
> The inner #; comments out the following 'C, but the list structure that
> lies a layer above it is still read as a complete S-expression -- in
> particular, (LIST (QUOTE B) (QUOTE D)) --.  Then the outer #; comments
> that out, leaving only (LIST (QUOTE A) (QUOTE E)), which evaluates to
> the list (A E).

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

#;#;a =>

#;#; a => a

#;(a b) =>

#; (a b) => (a b)

(#;a b) => (b)

(#; a b) => (a b)

(#;#; a b) => (a b)

(#; #; a b) => (a b)

(#; #;a b) => (b)

(#;a #;b) => ()

(a #; b #;c) => (a b)

And just to be certain, as earlier comments make reference to strings,
although suspect not intended, #; should defiantly not affect what's inside
of strings, as strings are themselves an literal expression unto themselves:

#; "a b c" => "a b c"

#;"a b c" =>

"#;a b c" => "#;a b c"

Let's at least try to make such a feature as consistent with similar
syntactic abbreviations;

As I don't suspect anyone would expect:

''a b c => (quote a) (quote b) c ; would they?

They'd expect:

''a b c => (quote (quote a)) b c

Where possibly with respect to:

> Aubrey Jaffer wrote:
> -- Function: comment string1 ...
>     Appends STRING1 ... to the strings given as arguments to previous
>     calls `comment'.
>
> -- Function: comment
>     Returns the (appended) strings given as arguments to previous calls
>     `comment' and empties the current string collection.
>
> -- Load syntax: #;text-till-end-of-line
>     Behaves as `(comment "TEXT-TILL-END-OF-LINE")'.

(comment ...) seems like a nice feature, but personally suspect it's just
As convenient and feature preserving to utilize #; to lexically remove
expressions it's been prepended to, while preserving the explicit use of
(comment ...) within code. (but it's just an opinion).