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

Re: Multiline comments. WAS:Re: Recording what we decided *not* to do, and why

Thread Previous | Thread Next
From:
Glenn Linderman
Date:
August 7, 2000 13:57
Subject:
Re: Multiline comments. WAS:Re: Recording what we decided *not* to do, and why
Message ID:
398F230A.27CA69DC@Linderman.com
Hey! I finally got a message direct from -mlc!  Great!

This thread was not about multiline comments, but rather about in-line
comments.

I still think multiline comments should be

#<<token
...
token

That in mind, below are my reactions to your examples

Michael Mathews wrote:

> I like this quite a lot. Heck, even a C programmer could like #* ... *# !
>
> I wonder though about backwards compatability. Let me clarify what you
> propose with some examples:
>
>     code here; #your typical comment here

Yep.

>
>     some code; #*still a single line of comment, but how does parser know?

It doesn't, until it gets to the end of the line, doesn't find the terminating
*#, and decides the # meant end-of-line comment, not #* meaning in-line
comment, in this particular case.

I'd have the parser throw a warning for this situation (unterminated in-line
comment).

>     more code;
>     code #*inline comment here*# rest of code;

Yep.

>     #*
>         block comment here
>     *#

Nope.  Gotta use

#<<BLOCK_COMMENT
   block comment here
BLOCK_COMMENT

or your choice of other token instead of BLOCK_COMMENT.

>     code again;

I really believe that there is and should be a distinction between in-line and
multi-line comments, in order to be reasonably backward compatible.

The "#<<token" is big enough it won't be found by accident, but too big for
in-line comments.  The #< or #* is small enough for in-line comments, but
could have been used in single line comment days, so it better not
accidentally comment out a large block of code (there may be a ># or *#
somewhere later, so you'd get no warning).
--
Glenn
=====
There  are two kinds of people, those
who finish  what they start,  and  so
on...                 -- Robert Byrne



_____NetZero 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