On Mon, Aug 10, 2009 at 12:25 PM, Patrick R. Michaud<pmich...@pobox.com> wrote:
> I'd be fine with the ##(embedded comment solution) approach (doubling
> the #'s), but it's much less visually appealing to me.  I think I'd
> prefer to see a doubling of the bracketing chars instead of doubling
> the #'s -- the # is visually a "heavy" glyph and I'd prefer
> something a bit lighter.
>
>    #((embedded comment))
>    #{{embedded comment}}

I could definitely go with this.  The only question lies in how often
you're likely to find a doubled open-bracket at the start of a line.

However, let me toss out some other possibilities for consideration:

If you want lightweight, another possibility would be to insist that
an inline comment must be preceded by horizontal whitespace; so "#{
comment }" would be an end-of-line comment, whereas " #{ comment }"
would be an inline comment.  This is in keeping with the current
spec's use of whitespace to distinguish between a start-of-line
comment and an inline comment.  Then again, perhaps that's a bit _too_
lightweight.  And it adds to another problem that I have with Perl 6,
namely the variety of mandatory/forbidden whitespace rules.  They are,
IMHO, a necessary evil, and should be kept to a minimum.  Plus, when I
typed the latter one out in this message, the composition window
wrapped the line between the start of the quote and the #.  One of the
lesser purposes of an inline comment is when you're passing code
through channels that might insert word-wraps into the code: an
end-of-line comment has the possibility of breaking, whereas the
inline comment handles it without complaint.

Another possibility: instead of "##" for an inline comment, how about
some other two-character pair that starts with a '#', where the second
character is a non-bracketing character that's unlikely to be found at
the start of a line?  E.g., '#:' - the colon is visible, lightweight,
and is almost always tacked onto the end of something else.  In this
approach, the minimum number of characters needed for an inline
comment will be four: the '#:' pair, an open-bracket, and a
close-bracket.  (Compare to '#{{ ... }}', which requires a minimum of
five characters.)  It also avoids the question of how much repetition
of the '#' is permitted.  So:

  #line comment
  #:line comment
  #(line comment)
  #:(inline comment)

OTOH, :( ... ) is the Perl syntax for a signature; and it wouldn't be
unreasonable to find a signature at the beginning of a line.  Far less
common than the current situation of finding an open-bracket there;
but perhaps too common to ignore.  I'd recommend '#='; but if that
isn't already being used by pod, it should be reserved for use by pod
(and it's visually heavy).

What other symbols are reasonably easy to type, are visually
lightweight, and are unlikely to be found at the start of a line and
immediately followed by an open bracket?  Hmm... how about '#.'?

  #line comment
  #.line comment
  #(line comment)
  #.(inline comment)

-- 
Jonathan "Dataweaver" Lang

Reply via email to