rfc:function_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
Next revisionBoth sides next revision
rfc:function_autoloading [2013/08/30 14:20] – Add blurb about filename conventions. ircmaxellrfc:function_autoloading [2013/09/03 12:28] – Withdrawn ircmaxell
Line 4: Line 4:
   * Date: 2013-08-29   * Date: 2013-08-29
   * Author: Anthony Ferrara <ircmaxell@php.net>   * Author: Anthony Ferrara <ircmaxell@php.net>
-  * Status: Draft+  * Status: Withdrawn
   * First Published at: http://wiki.php.net/rfc/function_autoloading   * First Published at: http://wiki.php.net/rfc/function_autoloading
  
Line 267: Line 267:
  
 The only thing that is implemented is the ability to register a callback to attempt to load a function or constant (or class) when it is missing. How the callback maps structures to files is outside of the scope of this RFC. The only thing that is implemented is the ability to register a callback to attempt to load a function or constant (or class) when it is missing. How the callback maps structures to files is outside of the scope of this RFC.
 +
 +==== Doesn't This Complicate The Engine? ====
 +
 +Nope! The reason is that the current autoloading mechanism for classes is extremely fragile as is.
 +
 +For example, the implementation hinges on a global variable which sets the php-level callback to call on autoload. This requires setting up a //zend_fcall_info// struct, and a //zend_fcall_info_cache// struct, as well as dispatching a function internally to autoload. [[https://github.com/php/php-src/blob/9e17094cf4dde60432569246a9a59e48783530bb/Zend/zend_execute_API.c#L1066|The Current Implementation]].
 +
 +The implementation of //spl_autoload_call// and //spl_autoload_register// are also extremely complicated. [[https://github.com/php/php-src/blob/9e17094cf4dde60432569246a9a59e48783530bb/ext/spl/php_spl.c#L466|The current SPL implementation]].
 +
 +This refactor cleans both of these pieces up significantly.
  
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
rfc/function_autoloading.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1