Re: [SMARTY-DEV] RE: [SMARTY] php5 Iterators.
[email protected] (boots)
| Newsgroups | php.smarty.dev |
|---|---|
| Message-ID | <[email protected]> |
--- George Miroshnikov <[email protected]> wrote: > Hello Boris, > > Wednesday, January 19, 2005, 9:03:33 PM, you wrote: > > BB> boots wrote: > > >>FWIW, is_a is not available prior to PHP 4.2 so we would actually > need > >>to implement it. The Pear compat library has what appears to be an > >>adequate BC implementation: > >>http://cvs.php.net/co.php/pear/PHP_Compat/Compat/Function/is_a.php?r=1.15 > >> > BB> In fact we can just use function_exists. > > Or use version_compare() to test for PHP5+. > Undefined functions raises no errors as long as it's not called, > AFAIR. Okay, so you end up with platform specific code embedded into the operation of the routine and which is selected via switch or if's. Its kludgy in interpreted languages, particularly when each block will emit different code types for each platform. > >>I can see why people want to overload foreach for object support > >>under PHP5 > >>but I wonder if it might be a better idea to introduce a new tag > >>(say, forevery or onevery or something) even if just to keep the > >>amount of BC headaches and pitfalls to a minimum. > >> > BB> -1. > > -1 from me too. > IMO this will be too confusing. My point is that the current compiler isn't really well suited to spit out different code for different targets. If the compiler were a bit more plugable it would be far easier to swallow since only code appropriate for your platform would be loaded. As it is, I suspect that this will only add further bloat to good 'ol foreach which is already a little overworked. I'm not against it, I'm just suggesting that it may make sense to keep the PHP4 and PHP5 features more separated. Particularly since I haven't even seen a full BC solution to this problem yet. Best Regards, xo boots