Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

What do you know about source filters?

by Beatnik (Parson)
on Jul 15, 2002 at 09:33 UTC ( #181725=perlmeditation: print w/ replies, xml ) Need Help??


I'll be giving a talk on source filters at YAPC::Eu 2.00.2 and I'm looking for people that (ab)use/write source filters. I have the latest draft (This is what it's aboot) online of the text I'll use and was wondering what you all think of it. If it sucks, tell me WHY it sucks, if it's missing something tell me WHAT it's missing. It's ofcourse obvious that I can't discuss every source filter out there but I tried to discuss at least a few famous ones. Comments are welcome in this thread and optionally thru email (altho I'll be in Greece for 2 weeks). My e-mail address is in the header of the PDF. I still need to create the slides for it so watch out for baby pictures and other stuff Dominus discussed in his talk on presenting on conferences :)

PS: I just realized the header has an incorrect date set but last changes were made today.

...Perl is like sex: if you're doing it wrong, there's no fun to it.

Comment on What do you know about source filters?
Re: What do you know about source filters?
by shotgunefx (Parson) on Jul 15, 2002 at 10:36 UTC
    First off, it doesn't suck. Though one thing I personally like to see in papers is more practical code samples. (No offenses to the Acme modules.)

    Understanding this is an introduction for many and time is limited as well you are somewhat limited in what you can cover, but you may want to touch on more practical applications such as Switch


    "To be civilized is to deny one's nature."
Re: What do you know about source filters?
by broquaint (Abbot) on Jul 15, 2002 at 11:48 UTC
    Definitely a very good introduction for the very uninitiated since it not only describes the concepts of source filtering but also shows some code examples. One topic I thought that was notably missing though is the how difficult it is to modify the actual language. For example I've been working on Sub::Lexical on and off for the past couple of months and have found that it's pretty much impossible to cover every base when filtering perl. As merlyn has said many times in the past only perl can parse Perl. While most filters don't need knowledge of the whole language's syntactic structure there are so many areas in which a simple s/// just won't cut it. Perhaps source filtering isn't meant to be used for such purposes which I have in mind, but it does seem prime for adding that favourite language feature from blub ...


Re: What do you know about source filters?
by stefp (Vicar) on Jul 16, 2002 at 05:20 UTC
    I hate source filters, it reeks preprocessing. Preprocessors usually don't know much of the language they generates and that leads to defensive programing:

    #define ADD(a,b) a+b /* I should have writen (a+b) */ ADD(1,2)*3 /* gives 7 instead of 9 */

    If you are not convinced of preprocessor horrors, looks at the source of perl5. Yes, the C preprocessor gets us around the limitation of the language and it is one of the reason why C is still well alive. See the GNU macros that allows the same include files to be both K&R and ANSI-C. It works but it is not pretty. Parrot is indded written in C.

    But, I like TheDamian source filters because it gets me the perl6 flavor. So, I can get over my dislike of source filters. But they are still a hack.

    But really with perl6, I hope we will be able to deal with any input without pipelining processors.

    But there is more indeed to source filters than filters that translate a language in a lesser language. Your examples show that source filters can be useful _and_ lovable.

    -- stefp -- check out TeXmacs wiki

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://181725]
Approved by neophyte
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2014-07-26 15:25 GMT
Find Nodes?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:

    Results (178 votes), past polls