Apparently a previous posting of mine has been picked up by Perl-bashers. In retrospect, I shouldn't have been surprised. But I was.

The post I'm talking about proved the long-conjectured idea that Perl parsing reduces to the Halting Problem and is therefore not, in general, decidable. Stating that as "Perl is Unparseable" is a bit dramatic, but that was the terminology used in the discussion when I found it.

Unparseability is not a feature Perl folks need to be defensive about, or to minimize. Unparseability is one of the great things about Perl. OK, not unparseability in and of itself, but the ability to use the full power of the language at parse time. Because that full Turing machine power is what produces unparseability as a side effect.

Compile-phase processing is heavily used in Perl, and having the full language available at that point is one of its major advantages over other languages. That's why nobody ever talks about "fixing" Perl's unparseability. It's not a problem and doesn't need a fix.

With the usefulness of having the full language in the compile phase, contrast the unparseability downside: yes, there are potential Perl programs that cannot be parsed. None I've ever wanted to actually use, mind you. The only Perl programs I've encountered that don't parse are the artificial ones invented for the discussion of unparseability.

So the trade-off is practical power for theoretical purity. Thank you, Larry Wall. And, hey, designers of other languages! How come you didn't make such a smart trade-off?

So, monks, next time you hear Perl jeered at for having undecidable parsing, just tell 'em -- demanding a parseable language is the sign of weak programmer.

[ My proof is available in a series of three articles in The Perl Review, now available online. The TPR articles should be preferred to my original post because they are more fully explained, were carefully rewritten, and benefited from editing by brian d foy. ]


In reply to Unparseability is A Good Thing by Jeffrey Kegler

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.