Re: [PEPr] Comment on RFC::EvalForbiddance
| From: | Travis Swicegood | Date: | Tue, 16 Aug 2005 19:22:58 +0000 |
| Subject: | Re: [PEPr] Comment on RFC::EvalForbiddance | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-39432@lists.php.net to get a copy of this message | ||
Hi all,
Joshua Eichorn wrote:
There are a 2 major cases where eval can't be replaced. Providing compatability between php5 and php4, (generally this is about about not throwing warnings in php5) Generating classes on the fly, wsdl stub classes or mock objects are what I can think of off the top of my head.First, isn't there a PEAR class to handle just such a case? I thought you mentioned it in your article on eval() a few weeks back? Second, phpUnit2 and SimpleTest already handle eval() for you with their Mock systems so why would anyone have a need to create mocks by directly using eval()? I don't know that I'm necessarily for removing eval() completely from within PEAR, but I think it showing up in a PEAR package would be reason for a discussion to happen here as to why it's there and what it purpose serves. In my opinion, fear of a function/method is what causes the problem. If there's nothing online but "don't use that!" discussions about a function, it's that much harder for someone new to PHP to figure out why they're doing what they're doing. If, instead, there's a repository of discussions about why and when they're appropriate, it'll help them understand why and when eval() (or any other method) should and shouldn't be used. -Travis