Edwin Wiles wrote:
> On the other hand, the stated desire for this is for commenting out
> blocks of code. That might be more achievable with (I forget the right
> name for this) 'compile time directives' such as "#if", "#endif". We'd
> have to use a different opening syntax, since # is already taken for
> comments, but this might be of more general usefulnes than block
> comments.
Is # already taken for comments? Consider #line, which works fine as a
directive... maybe a hack, but... maybe we could hack in #if and friends too.
> [I have a sneaking suspicion that this is another one of those 'hot
> topics'. I suspect that we could abuse pod to achieve the block comment
> effect, but that would clutter up the documentation rather badly.]
I'd rather not see pod abused for block comments. It is not clear to me what
happens or should happen when someone tries to block comment out (using a pod
technique) code containing pod directives.
Other posters suggested that we already have block comments of the style:
sub block_comment {}
block_comment <<END
this is a block comment
END
While I think that is too verbose (although the first line need not be repeated),
there is a nice attraction to being able to define the end-of-comment sequence...
it cures the need and desire for nested comments, and I hope I never hear anything
more about overlapped comments, other than the earlier posting that mentioned them.
This technique also doesn't support _in-line_ comments such as (C style)
foo = a + b /* in-line comment */ + c * d;
So, is there a solution? Maybe this one will inspire better ones:
#!perl -w # must be an option list, start of the perl script
# single line comment
#line 43 "filename" # must be a directive
#line 56 # must be a directive
#<<END
can we make this a multi-line comment please?
END
# the above was suggested in posts later than the one I'm responding to... I
thought
# of it independently, so at least one other person will like my idea! And maybe
# that means it seems "natural" since we independently thought of it?
$foo = $a + $b #< can this be an in-line comment? ># + $c * $d;
Note that with this scheme it would be possible to allow in-line comments to be
multi-line comments, or possible to prevent that. I'd vote in favor of keeping
in-line comments on a single line.
Note that with this scheme it would be possible to allow multi-line comments to
start in the middle of a line, or possible to prevent that. I'd vote in favor of
making them start as the first thing on the line.
Note that with this scheme it would be possible to allow "stuff" after the
multi-line comment introducer "#<<TOKEN", or possible to disallow that. If
allowed, it would be possible to treat it as either code or comment. I'd vote
against treating it as code.
> E.W.
--
Glenn
=====
There are two kinds of people, those
who finish what they start, and so
on... -- Robert Byrne
____________NetZero Free Internet Access and Email_________
Download Now http://www.netzero.net/download/index.html
Request a CDROM 1-800-333-3633
___________________________________________________________