Re: Re: RFC: source files without opening tag

From: Date: Mon, 09 Apr 2012 13:40:07 +0000
Subject: Re: Re: RFC: source files without opening tag
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-59503@lists.php.net to get a copy of this message
On Mon, Apr 9, 2012 at 9:16 AM, Rick WIdmer <vchkpw@developersdesk.com> wrote: > > Option 1: Introduce require_path > > I think require_code is a better name.  Parm 1 isn't a path, it is a file, > so require_path seems wrong to me. Yeah, you're not the first to say this. require_file and require_code have both been suggested. I'm fine with either really. > I'd prefer a 'start in code mode' optional second parameter to > include[_once] and require[_once]. That would be fine as far as my goals here go, but I'm concerned that we'll just repeat this discussion if any other options for requiring things come into being (: > Option 2: Filename Convention > > The PHP engine should not know or care what the file extension is.  I won't > object if you can convince autoloader authors to follow the .phpc > convention.  Personally, once I can count on this feature, every file I > include/require will probably be written starting in code mode and using the > new calling convention.  Even when I use PHP to create page templates.... Sounds like you're basically OK with that bit. > Additional suggestions: > > Add an option so the CLI can start in code mode too. > > Add another Handler to the Apache SAPI, maybe application/x-httpd-php-code > similar to x-httpd-php and x-httpd-php-source, so we can configure Apache to > start arbitrary file extensions with code mode on.  This defers setting the > action for various file extensions to the person configuring the web server. > > Other web server SAPIs will need similar treatment, but I'll leave them to > someone with personal experience. I'm not opposed to these suggestions. I was trying to keep it conservative and simple to implement and focus on the case where it bugs me (creating libraries of class files), but I'd be happy to see a way for .phpc to be the entry point / frontend controller / standalone script as well. As you say it must be done with SAPI options (the CLI included), not hardcoded file extension checking. -- Tom Boutell P'unk Avenue 215 755 1330 punkave.com window.punkave.com

« previous php.internals (#59503) next »