rfc:object_cast_magic

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:object_cast_magic [2012/02/29 02:43] – [Example] ircmaxellrfc:object_cast_magic [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 1: Line 1:
-===== Request for Comments: Weak References =====+===== Request for Comments: Object Cast and Assign Magic Methods =====
   * Version: 0.1   * Version: 0.1
   * Date: 2012-02-28   * Date: 2012-02-28
   * Author: Anthony Ferrara <ircmaxell@php.net>   * Author: Anthony Ferrara <ircmaxell@php.net>
-  * Status: In Draft+  * Status: Withdrawn 
 + 
 +Note that this RFC has been withdrawn in favor of the updated https://wiki.php.net/rfc/object_cast_to_types RFC (due to feedback from several developers).
  
 ===== Introduction ===== ===== Introduction =====
Line 9: Line 11:
 Currently, the Zend Engine exposes several methods to PECL extensions and internal classes to control how internal objects behave when casting to primitives, and when assigning to the variable that used to hold the object.  The three methods are specifically //cast_object()//, //get()// and //set()// This proposal is to expose those three methods as two magic methods to allow user classes to hook into this functionality. Currently, the Zend Engine exposes several methods to PECL extensions and internal classes to control how internal objects behave when casting to primitives, and when assigning to the variable that used to hold the object.  The three methods are specifically //cast_object()//, //get()// and //set()// This proposal is to expose those three methods as two magic methods to allow user classes to hook into this functionality.
  
 +It should be noted, that this requires no engine changes to implement.  All it is doing is exposing three engine handlers that are already existing and functioning for internal classes to userland classes via magic methods.  Therefore, there really is no new significant functionality, other than allowing userland code to implement the handlers.
 ===== Use Cases ===== ===== Use Cases =====
  
Line 114: Line 117:
   * https://wiki.php.net/internals/engine/objects#cast_object   * https://wiki.php.net/internals/engine/objects#cast_object
  
 +===== Questions =====
  
rfc/object_cast_magic.1330483397.txt.gz · Last modified: 2017/09/22 13:28 (external edit)