Re: RFC: source files without opening tag

From: Date: Mon, 09 Apr 2012 22:17:51 +0000
Subject: Re: RFC: source files without opening tag
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  Groups: php.internals 
Request: Send a blank email to internals+get-59571@lists.php.net to get a copy of this message
My original goal was to stop typing <?php in pure code files. That includes at the top. I think it's entirely reasonable to achieve it with an option to the require keywords for this purpose and a naming convention to be followed by autoloaders. Keep in mind how rarely you have to change them. We're talking about code maintained by a relatively small number of very sharp developers. They can handle a few flags (: The prohibition of ?> still seems unnecessary and perhaps divisive, but if it were preferable to the majority to prohibit ?> in a pure code file, I could live with that as long as classic PHP files are also 100% supported and remain the default. I'm trying to craft a broadly acceptable compromise that still achieves the original goal of allowing people to write "just code" in a class file. On Mon, Apr 9, 2012 at 6:06 PM, Kris Craig <kris.craig@gmail.com> wrote: > > > On Mon, Apr 9, 2012 at 2:38 PM, Luke Scott <luke@cywh.com> wrote: >> >> > Obviously, it would need to be at the top of the PHP file (whitespace >> > notwithstanding).  Since we don't want any BC breaks, we at very least >> > need >> > it to start with "<?" so that we don't end up parsing anything that >> > wasn't >> > mean to be parsed.  So how about we keep it simple and just use a >> > single, >> > "<?phpp" at the beginning of the file?  No ?> would be allowed after >> > that. >> > Anything before that (in the file itself) would also be ignored and >> > throw a >> > warning. >> >> Remember, <?xml tags. I think <? By itself was deprecated for this reason. > > > Bah, right!  That damned <?xml tag.... > > I already know what everyone's reaction will be, and it is probably a REALLY > bad idea, but I feel obligated to at least mention it:  Should we consider > replacing "<?..." with something that doesn't conflict with anything, > perhaps starting in PHP 6?  No need to get out the torches and pitchforks, > everyone!  As insane and problematic as that would be (i.e. BC break with > roughly 1/3 of the internet lol), I felt as though the subject should at > least be broached.  ;P > >> >> >> > This sounds like the best approach, given the limitations involved with >> > webserver configurations.  I'm still very much against though allowing >> > ?> >> > within one of these files (included or otherwise), as it really defeats >> > the >> > whole purpose and would just encourage poor architecture without any >> > countervailing benefit. >> >> Agreed. Disallowing ?> in a file in pure code means only one <?php tag >> at the top. >> >> >> A flag on require/include is acceptable to me, as long as the default >> mode is configurable in the php.ini file (when none are specified). > > > Perhaps we should split that into a separate RFC?  I.e. a require flag that > tells it to parse the included PHP file as pure PHP, regardless of whether > or not it has the <?phpp tag.  I'm not sure if this would be > workable/necessary or not, but it's different enough that I think splitting > it off into a separate proposal would probably make the most sense. > >> >> >> Luke >> >> > >> > --Kris > > -- Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.com

« previous php.internals (#59571) next »