Okay, so no one seemed to be offended at my original post/suggestion -- must
mean I should try to take it a little further :)

Here's the RFC in POD even.

--Michael


=head1 TITLE

Multiline Comments for Perl.

=head1 VERSION

  Maintainer: Michael J. Mathews <[EMAIL PROTECTED]>
  Date: 01 Aug 2000
  Version: 1
  Mailing List: perl6-internals
  Number: 1

=head1 ABSTRACT

Unlike many programming languages Perl does not currently implement true
multiline comments. This can be confusing/tedious to programmers. This could
be solved by adding a syntax to Perl 6 that would allow for true multiline
comments.

=head1 DESCRIPTION

Comments are important to programmers as a way of documenting their code and
for debugging purposes. While it is true to add formatted documentation to
perl using POD tags, this can be overkill if a programmer simply wishes to
add lines of information here and there that are not intended to be public.
In fact crafty programmers can even simulate multiline comments using POD
tags, but this seems like a misuse of a feature intended for another
purpose, and can interfere with real PODs in a script.

=head1 IMPLEMENTATION

Perl currently allows for sigle-line comments using the pound-symbol "#".
Any implementation of a Perl multline comment should feel similar to this.
However (ideally) the multline syntax would be unique enough so that it
would not conflict with older scripts using the literal "\#" (in a regex for
example) or in any single-line comment of arbitrary text.

=head2 Nesting

Since multiline comments will have a beginning and an ending it will be
possible to nest and overlap commented sections of perl. Nesting and
overlapping should be allowed and supported. In the case of nesting, the
outermost comment is enforced, in the case of overlapping the comments
should be treated as if they were joined. In the case of a single-line
comment overlapping a multiline comment, the multiline would end the
sigle-line comment and would in all other ways take precedence.

=head2 Proposal

Using a two-character syntax to start and end a multiline comment seems to
be a good way to satisfy both the desired similarity to "#" and the desired
uniqueness to avoid collision with real single-line quotes. I would suggest
a (# many lines of comment #) syntax:

 this is not ignored;
 neither is this; (# this
 is a
 multiline
 comment so it IS
 ignored #) but this is not ignored;

It would be very rare to find the "(#" or "#)" character combination in a
perl script being used as part of a single-line comment, and yet it is an
intuative extension of "#" idea.


=head1 REFERENCES

Reply via email to