PPI is nice for static parsing, but this should work in any dynamic context. (Just think about an imported sub using prototypes, and hence dynamically altering the parsing rules)

Let me pick one out of all the problems source filters have:

Combining them with others, or even nesting them.

They try to parse a whole file globally and introduce code at a distance. The next filter sees that output and is confused. The resulting problems are a nightmare to debug.

This can't happen here.

That's why macros are such a powerful tool in the lisp world.

Of course they should be used with care and have pitfalls ( see "hygienic" macros), but that's a problem all code generation has.

There are many longer elaborations about the limitations of source filters, I'd like to point you there.

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice


In reply to Re^4: Combining Import and Source-Filter to implement Syntactic Macro mechanism by LanX
in thread Combining Import and Source-Filter to implement Syntactic Macro mechanism by LanX

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.