From: David Masover Date: 2009-02-12T04:52:50+09:00 Subject: Re: Ruby vs Perl performance Chad Perrin wrote: > On Wed, Feb 11, 2009 at 03:42:34AM +0900, David Masover wrote: > >> In fact, that's one complaint about Perl (or PHP) -- they both have a >> lot built in, and a lot polluting the root namespace, for things that >> may have once been very common tasks... I know I'd be (slightly) >> happier with PHP if templating wasn't a part of the core language. >> > > Really? Without templating, I'm not sure there's a *point* to PHP. It's > basically Perl with a lot of the good stuff stripped out, and templating > added into the core language. Very true. However, templating as a part of the core language is perhaps one of the stranger parts of it, and is certainly something which is ripe for abuse. I think the main point to PHP now is sheer ubiquity -- all the apps already written in PHP, including some really impressive systems like Drupal, and all the hosts which provide PHP out of the box, with the programmer having to do nothing more complicated than FTP to deploy. This also makes it dangerously quick to pick up -- you've already got a cheap and/or free website that lets you FTP in some static HTML files, and you want to, say, add a hit counter. Copy and paste some snippet into that HTML, change the extension to .php, and you're now a PHP developer. Either way, that is sort of a representative sample -- templating is part of the core language. It's really something that ought to be done in a library -- there's more than one good templating system (haml, anyone?), and you don't want your entire program to be a template. Perl used to be the same way, though. I think a recent release -- "recent" meaning "within the past five years or so" -- they moved "formats" out of the core language and into a library. But I think that's getting even more offtopic, so to bring it back to Ruby... The one piece that really seems out of place is the Regex syntax, but I can't complain. Everything else, whether pure or not, comes together in such a way as to make it easy to turn it into whatever you need -- Markaby is another example of why not to build templating into the core language. Why put something in the core language when it can be done in a DSL?