On Dec 30, 2007 8:10 AM, Jonathan Lang <[EMAIL PROTECTED]> wrote:

> Let's say that the programmer in question wants to comment out all but
> the third line; so he prefixes everything else with '#':
>  #if ($test)
>  #{
>    .say;
>  #} else {
>  #  .doit;
>  #}
> What the writer _wants_ this to do is the equivalent of:
>    .say;
> What he'd get with embedded comments would be the equivalent of:
>    else {

Isn't this still a problem if you have something like:

if ($test)
   #if ($test2)
   #} else {
   #  .dosomethingelse;
} else {

I know the answer is to comment at the beginning of the line instead of
later, but still, this is a fairly common practice and is likely to be just
as confusing (if not more, because of the whitespace rules), as allowing #()
to come at the beginning of the line.  I'm all for DWIM, but this seems like
it will lead to a lot of head scratching.

Most places in the grammar that have strange whitespace rules or require
other methods of disambiguation at least seem to have a good reason for it;
these are comments, should we really create a mess of potential compiler
errors and limit where embedded comments can be (not allowing them to be the
first thing on a line is pretty strange) just to use this particular
syntax?  Like someone else mentioned, every other language has multi line
comments without weird problems like this, why can't we just pick a
construct that isn't so prone to ambiguity?

I suggest we use # for single line comments and ##() for multi line comments
(just adding an extra leading # to differentiate).  This has the added
benefit of standing out a bit more to anyone skimming the code.

Reply via email to