Why are Perl source filters bad and when is it OK to use them?

后端 未结 7 1514
Happy的楠姐
Happy的楠姐 2020-11-30 07:55

It is \"common knowledge\" that source filters are bad and should not be used in production code.

When answering a a similar, but more specific question I couldn\'t

相关标签:
7条回答
  • 2020-11-30 08:26

    Why source filters are bad:

    1. Nothing but perl can parse Perl. (Source filters are fragile.)
    2. When a source filter breaks pretty much anything can happen. (They can introduce subtle and very hard to find bugs.)
    3. Source filters can break tools that work with source code. (PPI, refactoring, static analysis, etc.)
    4. Source filters are mutually exclusive. (You can't use more than one at a time -- unless you're psychotic).

    When they're okay:

    1. You're experimenting.
    2. You're writing throw-away code.
    3. Your name is Damian and you must be allowed to program in latin.
    4. You're programming in Perl 6.
    0 讨论(0)
提交回复
热议问题