|laziness, impatience, and hubris|
Re: Re: Macros, LFSPs and LFMsby adrianh (Chancellor)
|on Jun 15, 2003 at 01:30 UTC||Need Help??|
Perl doesnt need a macro language because it is a better macro preprocessor than anything else out there all by itself. With closures and eval, source code filters and funky things like BEGIN/INIT blocks and friends, Perl doesnt need anything that a macro preprocessor can provide.
Yes it does. It needs the ability to get at the parse tree.
Once we have the ability to read and write the parse tree at compile time (and change the grammar rules that make the parse tree) we have a lot more flexibility and power. This is what makes the addition of proper macros to Perl6 so exciting for me.
Take a look at the source for Switch. Nearly 500 LOC, large chunks of it dealing with parsing Perl.
Source filters are hard due to the "only perl can parse perl" problem. Adding new syntax is amazingly tricky to do in the general case because you have to deal with all the idiosyncratic elements of perl at the level of raw text.
Once you have more than one source filter on a piece of code things basically become impossible because at least one of those filters is going to have to parse "illegal" perl.
Anybody who thinks that having a macro facility indicates that a L is FSP obviously hasn't noticed VB's macros.
Anybody who thinks VB is a good example of a macro system has never used Lisp or Pop-11 or Scheme or ... :-)