SPUG: Self-generating code: yea or nay? (was: Dijsktra is Dead)

Tom Legrady legrady at earthlink.net
Fri Aug 9 16:10:01 CDT 2002

 Asim Jalis <asimjalis at yahoo.com> wrote:

>Are there any examples of Code Generation where it
>is used to non-routine non-mindless code?

I have a module in CPAN, Text-ASED.pm, which provides
an interface to file editing, search-and-replace. While my
module is not as powerful as the Perl 5 regular expressions 
on which it is based, it is simpler to understand for complex 
expressions, and simplifies the separation of the S-n-R strings
from the code, thus supporting I18N.

The modifications to be performed are parsed into a Perl script
which is then eval-ed. Since each module command can
contribute to the initialization segment and may generate a
loop or conditional block, it is far simpler to generate the 
code than to perform interpretation in the methods themselves.

Tom Legrady

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org

More information about the spug-list mailing list