develooper Front page | perl.perl6.language.mlc | Postings from August 2000

Re: RFC: multiline comments

Thread Previous | Thread Next
From:
Glenn Linderman
Date:
August 3, 2000 11:33
Subject:
Re: RFC: multiline comments
Message ID:
3989A42F.C20A466D@Linderman.com
John Porter wrote:

> Glenn Linderman wrote:
> > >
> > > qc( Here's a quick comment which actually contains
> > >     qc( another comment )
> > >     within it
> > >   );
> >
> > This type of comment will not comment out arbitrary text.
> > In particular, it might have problems with text containing
> > mismatched (){}<>.
>
> This is already an issue with the existing q.() operators  --
> which is to say, I don't think it's something we need to worry about.

Perpetuation of existing issues doesn't make the language easier to use.
And while the existing q.() operators are typically used to surround
fairly short blocks of text, with controlled content, the desire to
comment out blocks of existing code with a multi-line comment facility
has different goals, that are hard to meet with a single character
delimiter, especially a paired one that results in scanning of the
internal content for consistent usage of the delimiter.

> That's not to say that we shouldn't have multi-char q.() delimiters;
> being able to say qq({ })  might be nice, for example.

I wouldn't say that either, but I think others did.

> Also consider the impact of Unicode, which will allow any reasonable
> pair of matching Unicode characters.  I.e. instead of multi-char,
> think wide-char.

See my follow-up note in perl6-language regarding the Unicode fallacy.

> > And yet using non-paired
> > delimiters doesn't allow commenting out comments.
>
> Since what I think this means is false, you probably mean
> something else...

Probably so.  Let me try again:

Consistent use of the same single delimiter character for comment
delimiters, which would be a nicety for long and frequent comments,
doesn't allow commenting out comments.

This forces one to use different delimiter characters for different
usages of comments.  The set of reasonably unused characters (without
invoking the Unicode fallacy) is small, making the choices hard.

A multi-character delimiter seems required to me to make it easy to
identify a delimiter which can be safely used.  One very Perl-ish
technique for multi-character delimiters is

<<END_OF_TEXT

stuff


END_OF_TEXT

Together with the very Perl-ish technique for comments (the '#'
character) this leads very obviously to:

#<<END_OF_TEXT

comment stuff

END_OF_TEXT


It is easy to scan column 1 of a script to determine if the chosen token
appears within the area being commented out, whereas determining a single
character that could be used requires examination of the whole content of
the area, character by character.

> --
> John Porter

--
Glenn
=====
There  are two kinds of people, those
who finish  what they start,  and  so
on...                 -- Robert Byrne


_______________________________________________
Why pay for something you could get for free?
NetZero provides FREE Internet Access and Email
http://www.netzero.net/download/index.html

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About