Moritz Lenz <mor...@faui2k3.org> writes:

> In all other cases of quote like constructs are the semantics are
> explicit first (think of Q, qx, m, <, «), the delimiter comes later.
> Changing that all of a sudden seems very unintuitive and wrong.

  Thing is, comments are not quote-like.  All of the quote-like
constructs are expressions.  Comments are not.

  Different things should be different, and comments should not look
like expressions.  Or so it seems to me, at least.


  Rambling along ...


  In C++, all comments start with the same character, but it is the
end-of-line comments that start off with it doubled up.  And so C++
avoids these gotchas.

  Alternatively, if end-of-line comments required whitespace (or some
other non-bracket non-# character class) after one or more #
characters, it would not just resolve the gotchas: It would make the
comments far easier to read as well.  Meanwhile, a # sequence followed
by neither whitespace nor brackets would be a syntax error, and I
imagine that might make it hard to sell.

  Too late for Perl to go that way though. (Right?  Yeah, right.)


  The only other way for Perl to avoid these gotchas and still retain
the two kinds of comments seems to be if the two constructs start with
different characters.  Putting the delimiter first is one way of doing
it.  Reserving one more comment leading character would be another.
Seems expensive though. :-\

  So, are the more ways to design it with a different leading
character?  :#( ... ) has been suggested, and it is begginning to grow
on me.  :# ... #: could work, I suppose (it is not a quote-like
expression, so doesn't need to look like it is) – but since the closer
there starts with a #, I imagine that might run into similar trouble.

  An unspace-like \#( ... ) could perhaps work?


  ... though I get the feeling someone else has rambled along these
lines before ...


Eirik
-- 
Ceci n'est pas une .sig.

Reply via email to