rfc:core-autoloading

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:core-autoloading [2023/04/10 12:11] – Link to autoloader-maps extension girgiasrfc:core-autoloading [2023/04/23 14:24] (current) danack
Line 4: Line 4:
   * Date: 2023-04-03   * Date: 2023-04-03
   * Author: George Peter Banyard, <girgias@php.net>, Dan Ackroyd, <danack@basereality.com>    * Author: George Peter Banyard, <girgias@php.net>, Dan Ackroyd, <danack@basereality.com> 
-  * Status: Draft+  * Status: Under Discussion
   * Target Version: PHP 8.3   * Target Version: PHP 8.3
   * Implementation: [[https://github.com/php/php-src/pull/8294]]   * Implementation: [[https://github.com/php/php-src/pull/8294]]
Line 249: Line 249:
  
 Passing <php>spl_autoload_call()</php> to <php>spl_autoload_unregister()</php> is deprecated. Passing <php>spl_autoload_call()</php> to <php>spl_autoload_unregister()</php> is deprecated.
 +
 +The current RFC as proposed has a large BC break for the code:
 +
 +<PHP>
 +
 +namespace foo;
 +
 +var_dump(function_exists('foo\strlen'));
 +var_dump(strlen('x'));
 +var_dump(function_exists('foo\strlen'));
 +
 +if (true) {
 +    function strlen($x) { return 42; }
 +    var_dump(function_exists('foo\strlen'));
 +}
 +
 +var_dump(strlen('x'));
 +
 +</PHP>
 +
 +Which needs to be thought about.
  
 ===== Proposed PHP Version ===== ===== Proposed PHP Version =====
Line 396: Line 417:
 For programs that do not have a function autoloader registered, there will be no autoloader to dispatch, so there will be almost no performance change. For programs that do not have a function autoloader registered, there will be no autoloader to dispatch, so there will be almost no performance change.
  
-Whether or not a fuction autoloader is registered, resolving the function is only done once per function per namespace, assuming the function is either loaded or resolved through the global fallback.+Whether or not a function autoloader is registered, resolving the function is only done once per function per namespace, assuming the function is either loaded or resolved through the global fallback.
  
 As the code example shows, after a successful attempt to autoload a function in a namespace, or the global function fallback occurs, the function is 'pinned' to that function, and subsequent use doesn't trigger autoloading. As the code example shows, after a successful attempt to autoload a function in a namespace, or the global function fallback occurs, the function is 'pinned' to that function, and subsequent use doesn't trigger autoloading.
rfc/core-autoloading.1681128718.txt.gz · Last modified: 2023/04/10 12:11 by girgias