rfc:source_files_without_opening_tag

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:source_files_without_opening_tag [2012/04/10 23:45] – [Why is this desirable?] boutellrfc:source_files_without_opening_tag [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== ABANDONED ======
 +
 +I have abandoned this proposal. I have come to feel it changes the spirit of PHP too much, offering too little gain for the degree of unhappiness it inspires and the potential for confusion it creates. I am leaving it here for historical purposes. -Tom Boutell
 +
 ====== Request for Comments: Source Files Without Opening Tag ====== ====== Request for Comments: Source Files Without Opening Tag ======
-  * Version: 1.1 +  * Version: 1.1.1 
-  * Date: 2012-04-10+  * Date: 2012-04-16
   * Author: Thomas Boutell <tom@punkave.com>   * Author: Thomas Boutell <tom@punkave.com>
   * Status: Under Discussion   * Status: Under Discussion
Line 32: Line 36:
 === Part 1: Enhance the include, include_once, require and require_once keywords === === Part 1: Enhance the include, include_once, require and require_once keywords ===
  
-These keywords will be enhanced with a second, optional parameter.+These keywords will be enhanced with a second, optional parameter introduced by the "AS" keyword.
  
 The first parameter (the URL/filename to the file to be included) does not change. The first parameter (the URL/filename to the file to be included) does not change.
Line 54: Line 58:
      
   // Load filename.phpp. This file must consist purely of source code, no <?php or ?> tokens needed or permitted   // Load filename.phpp. This file must consist purely of source code, no <?php or ?> tokens needed or permitted
-  require 'filename.phpp'INCLUDE_PURE_CODE;+  require 'filename.phpp' AS INCLUDE_PURE_CODE;
        
   // Behaves just like include_once   // Behaves just like include_once
-  include 'filename.php'INCLUDE_ONCE;+  include 'filename.php' AS INCLUDE_ONCE;
        
   // Behaves just like require   // Behaves just like require
-  include 'template.php'INCLUDE_ERROR_ON_FAILURE;+  include 'template.php' AS INCLUDE_ERROR_ON_FAILURE;
        
   // Combine them all: includes only once, with a fatal error on failure, parsing in "code mode"   // Combine them all: includes only once, with a fatal error on failure, parsing in "code mode"
-  include 'filename.phpp'INCLUDE_PURE_CODE | INCLUDE_ONCE | INCLUDE_ERROR_ON_FAILURE;+  include 'filename.phpp' AS INCLUDE_PURE_CODE | INCLUDE_ONCE | INCLUDE_ERROR_ON_FAILURE;
        
   // Exactly the same as previous example   // Exactly the same as previous example
-  require_once 'filename.phpp'INCLUDE_PURE_CODE;+  require_once 'filename.phpp' AS INCLUDE_PURE_CODE;
      
 === Part 2: Filename Convention === === Part 2: Filename Convention ===
Line 113: Line 117:
 Bitwise flags are faster and also provide built-in error checking: use of a constant not defined by a particular version of PHP will generate a notice. Require statements are something PHP executes quite often, so generating unnecessary arrays and testing array values is an unnecessary performance hit. Bitwise flags are faster and also provide built-in error checking: use of a constant not defined by a particular version of PHP will generate a notice. Require statements are something PHP executes quite often, so generating unnecessary arrays and testing array values is an unnecessary performance hit.
  
-===== Changelog =====+**"Why is the AS keyword necessary? Why not a comma?"**
  
-  * 2011-04-09 Yasuo Ohgaki: Added related RFC. +Since these keywords are language constructs, not functions, and their parameters are not enclosed in parentheses, the meaning is ambiguous with a commaRight now ''foo(include 'baz', INCLUDE_ONCE)'' would pass two separate values to the ''foo'' functionChanging this in the grammar would be problematicThe use of the AS keyword removes the ambiguity. 
-  * 2011-04-10 Thomas Boutell: removed misleading word "Option" from parts 1 and 2, which are not meant to be mutually exclusive (see the original text). + 
-  * 2011-04-10 Thomas Boutell: version 1.1Replaced ''require_path'' with enhancements to the standard ''include''/''require'' family of keywordsReplaced an array of options with a bitwise OR of optionsForbade the use of ''?>'' entirely in pure PHP files (without restricting it at all in other PHP files).+===== Changelog =====
  
 +  * 2012-05-06 Thomas Boutell: formally abandoned by original proponent.
 +  * 2012-04-09 Yasuo Ohgaki: Added related RFC.
 +  * 2012-04-10 Thomas Boutell: removed misleading word "Option" from parts 1 and 2, which are not meant to be mutually exclusive (see the original text).
 +  * 2012-04-10 Thomas Boutell: version 1.1. Replaced ''require_path'' with enhancements to the standard ''include''/''require'' family of keywords. Replaced an array of options with a bitwise OR of options. Forbade the use of ''?>'' entirely in pure PHP files (without restricting it at all in other PHP files).
 +  * 2012-04-16 Thomas Boutell: added Nikita Popov's "AS" keyword as a workaround for the fact that a comma can't be introduced between the two parameters without creating an ambiguity in the grammar.
  
rfc/source_files_without_opening_tag.1334101535.txt.gz · Last modified: 2017/09/22 13:28 (external edit)