Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • > Old New
    > --- ---
    >/patpat(?#text)/ /pat pat /

    Would there be something wrong with instead allowing

                              either /pat pat /
                                      or /pat pat /
                                      or /pat pat /

    or something that *looks* like more a comment instead of looking like a single-quoted string?

    I understand that the single-quoted string asserts as true, but in some cases, single-quoted strings asser to false. I can imagine that programmers who never use string assertions could learn from example that the above is "how to do an inline comment" rather than learning that the above is "how to assert a string". If they learn this, then they're liable to get bit one day by or something like that.

    As long as we're trying to dump special cases, why not allow a syntax for inline comments? If no special syntax is to be provided, then I'd shy away from saying "here's a kludgey way to do it" because that will just encourage folks to abuse the syntax until they learn the hard way what the sytax *really* means.

    • As Larry says in the 'poco', /x is the default, meaning you can have inline comments like this:

          / x is the default # so this is a comment
              and this is not a comment /

      At least that's what I remember from yesterday. I wish was up so I could confirm that ;)
      • is back up (at least for me)

        apo5 explicitly (in text, and by examples such as the one quoted in my post above) says that to get an inline (meaning, I don't want to break my regex into two lines) comment you should assert a string.

        So, inline comments don't currently have a syntax, and instead, there is explicit advice to assert a string. I'm wondering whether we can either come up with an appropriate syntax, or not explicitly advise folks to use a kludge.

        It just feels like there's something amiss
        • Well, I checked again and you're wrong.

          Go to page 6 [] and look at the table at the bottom.

          The very first example shows an inline comment.
          • > Well, I checked again and you're wrong.

            Given that he defined "inline comment" to mean "I don't want to break my regex into two lines", he's very much correct. And since that's how Larry refers to inline comments, I'm inclined to agree with him on that definition.

            In fact, I'll agree with him across the line: A5 is good, I couldn't do better, this is a nit pick, telling people to use a string assertion as an inline comment is a time-bomb.

            Personally I don't much care if we have inline comments (even
            • Oops, I didn't read wickline's message carefully enough. I missed the part about not wanting to break the regex into two lines.

              Geez, what a weird nitpick though. I agree that telling people to use inline strings is potentially a problem, but why would you insist on single-line regexes?

              Do you try to keep all of you other code on one line too? ;)

              • > why would you insist on single-line regexes

                Personally, I have zero attachment to in-line comments
                in regexen. If your regex is short enough to fit on
                one line with an inline comment, then it can darn well
                fit on one line with a comment at the end of the line.

                So, if there is no support for them, I don't mind.

                However, perl5 supports them, and rather than saying
                that they go away in perl6, the apo currently documents
                (and recomends?) the practice of asserting a string.

                *That* is my real nit pick. I think t
                • Personally I think asserting a string's a great idea. If it weren't for the fact that it throws a warning at the moment I reckon that 'string in a void' context has potential to be used as a comment elsewhere in perl. But that might be seen as stealing a little too much from smalltalk.
                • The only reason it's in there is so that the p52p6 translator will know what it's supposed to translate (?#...) to. Yes, it'd be possible to translate it to a line-ending comment, but it's better if the translator avoids changing line numbers whenever possible.

                  • > so that the p52p6 translator will know what
                    > it's supposed to translate (?#...) to.

                    Then the translator shoudl probably have a special
                    check for inlined empty or '0' (zero) comments. I
                    don't use inline comments myself, but I can imagine
                    that someone who does use them might start to type
                    an inline comment and then forget to fill it in if
                    they got a phone call, or sudden inspiration in a
                    more troubling bit of code somewhere else.

                    I have more trouble imagining a (?#0) comment, but
                    it seems like a good idea t
    • hmmm...

      I should have used preview. I need to start posting as Code instead of Plain Old Text

      None of the three suggestions above look like comments.

      They should read as

      either /patpat<(#text#)>/
          or /patpat<#text#>/
          or /patpat<#text>/


      this long line added to get around slashcode avg 8.9 char per line requirement blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah bla