Jon Lang wrote:
smuj wrote:
Jon Lang wrote:
Here's a radical notion: use something other than '#' to initiate an
inline comment.


Or maybe just don't allow "embedded" comments unless they are actually
"embedded", i.e. if a line starts with a # (ignoring leading whitespace)
then it's _always_ a line-end comment, no matter what follows the #, e.g.

That has the advantage of preserving a three-character embedded
comment.  It has the disadvantage that you get differing behavior
depending on where the comment is on the line.  As I see it, the whole
point of this exercise is to get rid of the gotchas, and not just to
shift them around - thus my ':#' proposal.

I think whatever the solution is, it must begin with a # -- anything else will likely create even more gotchas. Also, we have to realise that no matter what sequence we choose for embedded comments, there will _always_ be a chance of a gotcha, so all we can do is minimise the likelihood, as well as making the gotcha easy to spot, whilst not making embedded comments too difficult to use for those who like them.

My current personal favourite would be to keep things as they are with regards to bracketing, but to introduce a + between the # and the brackets. I'd also change the terminology from "embedded" comments to "extended" comments. The + sign is a good mnemonic for "extended" IMHO. It's neither too much of a heavyweight nor too much of a lightweight. The +bracket sequence isn't "too" common -- or at least probably not where you might want to introduce a comment -- and it keeps "extended" comment syntax down to 4 characters, e.g.

say #+( extended comment ) "hello, world!";

$object\#+{ extended comments }.say;

$object\ #+「
    extended comments

#sub foo                    # line-end comment
#{                          # ditto
#   ...                     # ditto again
#}                          # what he said!

#sub foo                    # line end comment
#+{                         # extended comment
   ...                      # extends
}                           # to here


Reply via email to