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 /
    • 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 if the design specification is suggesting a kludge. Kludges should be for after the design has been implmented and found to be lacking, not an integral part of the design :)


        PS: no slight intended... I know if I were trying to do even a small part of this, I'd just plain do it Wrong rather than do it so well. This is just a nit pick, really.
        • 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