Slash Boxes
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

use Perl Log In

Log In

[ Create a new account ]

Aristotle (5147)


Blah blah blah blah blah []

Journal of Aristotle (5147)

Sunday April 29, 2007
12:47 AM

One howler is chasing the next here

[ #33146 ]

Zachary Kessin :

Code As Data: Reflection in PHP


There is a long history of using programs to automate the writing of code in C and similar languages (including Lex, yacc, lint, ctags, and others). For C programmers, many of these tools have been around in one form or another since the 1970s, and are very well understood by the community. However, for people who learned to code in PHP, Perl, and Python (the “P” languages), the use of tools like this may never have entered their horizon. This is unfortunate, because a solid tool chain for code generation and parsing can lead to better end code and higher programmer efficiency, as I will show here.

Once we establish that we can parse our code with a tool, then two questions remain: […]

It doesn’t let up either. The entire article is one comical tragedy, though much of it supplied by PHP itself rather than the author.

Sorry, PHP programmers, there are only three “P” languages, and one of them starts with an “R”.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I quite aggree that Perl, Python and Ruby are playing a different league from PHP. But that article sounded quite sane to me. Having a way to work with your compiled code is a good idea. I haven't used the PHP Reflection API, but judging from that article is looks like it is comparable to Perl 5's PPI.

    So I wonder what's the next thing that PHP is borrowing from saner languages. How about TAP?

    /* */
    • The idea that metaprogramming means parsing your own source and using that to fill in source code templates is so typical for PHP. This sort of thing “never entered the horizon” for programmers using the “P” languages. Seriously?

      I guess my point is that I’ve done a lot of metaprogramming in Perl in the decade before PPI existed. (And I don’t plan to use PPI anytime soon).