Stories
Slash Boxes
Comments
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.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • 100% "Round Trip" safety
    ... provided you don't change the document in any way, like perhaps "strip comments" or anything that is not the NULL transformation.

    If you do any transformation, you will not know that you've misparsed. You'll simply get the wrong result, and you will damage code.

    Although it took a new definition of "parse", perl is now no longer the only thing that can parse Perl.
    I know you're hinting at it with your definition of "parse" caveat there, but I think it deserves a better underlining.

    Your work, as massive an undertaking as it is, cannot be guaranteed to understand Perl in the same way that the perl compiler can. My oft-referenced (even by you) message "On Parsing Perl" [perlmonks.org] shows precise examples that PPI cannot ever get correct.

    Yes, you can round trip it to your fake tokens and back to Perl source code, but you cannot determine perl's actual tokenization, nor can you even know that you misparsed it. It'd be like saying that you take the source text and break it into two-character chunks, then take those chunks back to the original text. Whooptidoo.

    Yes, your code will be useful to 98% of those who want a static parsing of Perl code, but the problem is that you'll never know if you're in that last 2%, and it's impossible for PPI to tell if it got it wrong.

    --
    • Randal L. Schwartz
    • Stonehenge
    • I think the interesting question is whether a 98% solution is useful or useless. I'd say it's possible to do useful things with it. It's not like no-one knows Perl is dynamic.

      So let's not depend on PPI to tell if it got it wrong.

      If you're doing manual refactoring, do you have tests to back up your transformation? If you don't, you're doing it wrong. Same with using a PPI backed refactoring tool.
    • Randal, Why are you so overwhelmingly negative about this project? It looks a bit petulant. +Pete
      • Why are you so overwhelmingly negative about this project?

        I'm only negative to the point that the hype needs to be spin-corrected.

        When Adam presents a fair and balanced description of PPI, I've been quiet. But when he presents an offsetting view, I present a counter-offsetting view.

        It's about awareness. Not everyone knows why only perl can truly parse Perl, so they see PPI and get big googly eyes, when in fact it's not what it advertises itself to be, until you read all the fine print. When Adam

        --
        • Randal L. Schwartz
        • Stonehenge
      • Well, except that perl can't parse Perl either.

        This is no Perl.

        (But more on that at the OSCON talk) :)
    • Certainly, but then neither can perl. When it really comes down to it, it is equally possible for perl to get it wrong, or act incorrectly.

      And since there _is_ no language definition by which to define Perl, we simply say that "What perl parsers is what Perl is".

      What is the definition of sub'new {}?

      It's sub main::new {}. Is that a bug? It can't possibly be, because Perl is what perl parses.

      If you look beyond the issue of whether PPI "parses" Perl correctly, you'll see that "there is no spoon".

      There is no Pe
    • >> 100% "Round Trip" safety

      >... provided you don't change the document in any >way, like perhaps "strip comments" or anything that >is not the NULL transformation.

      And BTW, so I don't have to explain this again, the definition of "Round Trip" is that if you don't change a piece of code, it comes out the same as it went in, the entire point is that you don't change the document.

      PPI can do this, unlike every other attempt at a perl-based "parser" that I've seen.

      B:: is more of an attempt to creat