Problems? Is your data what you think it is?  
PerlMonks 
comment on 
( #3333=superdoc: print w/replies, xml )  Need Help?? 
Okay.. First of all, you need to spend some time meditating on the definition of the word 'language' as it applies to computer programming. It's a heavily overloaded term, and your post deals with a specific confusion of meaning between two very different definitions. On the one hand, we have 'languages' like Perl which are a collection of keywords and syntax. On the other hand, we have 'languages' like finite automata, pushdown automata, and Turing machines. Languages like Perl are really just syntactic sugar coating for a set of basic concepts which we use to express automata or Turing machines. A 'general purpose' language (of which there are about ten bazillion) supports the concepts necessary to create a Universal Turing Machine, an idea more commonly expressed as: "a language that can't compile itself isn't worth using." Of course, that isn't terribly difficult.. you can build a UTM with the operations '++' and '', two arbitrarily large named integer variables, a big lookup table, and a whole lot of time. Things like finite automata and Turing machines are the theoretical languages which identify the various types of problems a computer programmer can solve. Broadly speaking, there are five such languages:
And at the end of the day, ain't a damnthing any programmer can do that doesn't fall into one of those categories. Syntacticsugar languages like Perl support several different ways to express any one of those theoretical languages. %Hashes and @lists are parametric expressions, but so is a function that takes a parameter and returns a value. Perl's regular expression syntax gives us a convenient way to define finite automata, but that doesn't stop any program from having its own state chart. You can build a pushdown automaton with a finite automaton and a stack, or you can just make a set of nested function calls. When you get down to basics, programming consists of nothing but creating new syntacticsugar languages appropriate to the task at hand. Every function you name is a new keyword with its own set of semantics. And unless you're really into frustration and wasted time, the language you create has to be powerful enough to solve the problem at hand. You can't balance parentheses with a finite automaton (1), and you can't do binary multiplication with a pushdown automaton. (1) Yes, yes.. I know Perl's regex engine has a pragma for justintime compilation of targets which supports infinitely extensible, recursively defined patterns. A recursivelydefined *anything* is a context free grammar at the very least. The pragma boosts Perl's regex engine into the realm of pushdown automata rather than proving you can solve PAcomplete problems with a finite automaton. If you wish to argue otherwise, please include an implementation of the justintime pragma written only in Perl's regex syntax without the pragma. Now, it's interesting that you chose to complain about the minilanguages associated with template systems, because arbitrary string replacement  at least if you do it repeatedly  happens to be a Turingcomplete problem. In fact, 'arbitrary string replacement' is a fairly good description of lambda calculus. So.. given that you need a Turingcomplete language just to describe the problem any template system is trying to solve, you're pretty much stuck with two options:
Now, speaking as someone who's had to manage sites composed of firstclass executable pages, I can say with conviction that the separation of concern issues others have raised are NOTHING compared to the synchronization and versioncontrol issues inherent in trying to ride herd over a jillion different page/programs all loosely tied to the same code base. Sifting through all the pages in a site trying to find and update the cutandpaste code for a given display item is time consuming. Trying to ferret out all the instances of cutpasteandmodify code is exhausting. Factoring out a common code base for the entire site and then bringing all the pages in line is a dotX upgrade at the very least. And it lasts right up to the point where someone wants to do something new. So.. it seems to me that you're objecting to the creation of a specific kind of syntacticsugar language, which just happens to be Turing complete because that's necessary to describe the problem at hand, without presenting any really detailed argument as to why this particular new lanugage might be bad. Your only two real points: "If you need to do something the author hasn't thought of, you lose," and "who wants to learn another language?" apply equally well to the API of any Perl module on CPAN. Those are minilanguages too, and some of them are fairly complex. Show us some evidence that you're familiar with the problem domain before dismissing one kind of solution out of hand. In reply to Re: the disadvantages of minilanguages
by mstone

