Re: PHP class files without <?php at the top
| From: | Tom Boutell | Date: | Mon, 09 Apr 2012 18:45:08 +0000 |
| Subject: | Re: PHP class files without <?php at the top | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-59529@lists.php.net to get a copy of this message | ||
Such code would have the .phpc extension, so it wouldn't get loaded at
all by most autoloaders that aren't prepared for it I imagine.
This feature would certainly make the most sense as part of a new
version of PHP that introduces other new functionality. "I'm going to
use feature X in this code, which doesn't exist in version Y anyway,
so I may as well take advantage of not having to type <?php anymore as
well."
On Mon, Apr 9, 2012 at 1:33 PM, John Crenshaw <johncrenshaw@priacta.com> wrote:
> From: Tom Boutell [mailto:tom@punkave.com]
>>
>> On Mon, Apr 9, 2012 at 12:43 PM, John Crenshaw <johncrenshaw@priacta.com> wrote:
>> > interoperability is somewhat reduced in the sense that all 3rd party
>> > code would have to be checked for the <?php
>>
>> I'm not sure what you mean by this part exactly?
>
> Suppose a code library is written and the author writes it without the <?php at the head of
> each file. Using that library in a project that opted to keep the <?php requires adding this to
> the head of each file, or else ensuring that the library is always included with the code parameter
> set (which could get really messy with autoloaders.) Additionally (assuming that you modified the
> code files) updating the library in the future gets really messy. It's not the end of the
> world, but it's frustrating. I'd like to believe that most library authors will be smart
> enough to always include the <?php for compatibility purposes, but I'm sure some won't.
>
> John Crenshaw
> Priacta, Inc.
--
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com