rfc:automatic_get_set_methods
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
Previous revision | |||
— | rfc:automatic_get_set_methods [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Request for Comments: Automatic get/set methods for objects ====== | ||
+ | * Version: 1.0 | ||
+ | * Date: 2008-12-16 | ||
+ | * Author: Michael Kimsal < | ||
+ | * Status: Under Discussion | ||
+ | * First Published at: http:// | ||
+ | |||
+ | |||
+ | ===== Introduction ===== | ||
+ | |||
+ | Currently, PHP only allows for defining functionality during access to properties on an object when those properties are not defined in the class. | ||
+ | |||
+ | ===== Proposal version 1 ===== | ||
+ | |||
+ | When a class is initialized at runtime, each property will have a ' | ||
+ | |||
+ | ===== Proposal version 2 ===== | ||
+ | |||
+ | When a property on an object is attempted to be read, the PHP engine will look for a corresponding getXXX() method for the given property. | ||
+ | |||
+ | |||
+ | ===== Benefits ===== | ||
+ | |||
+ | This will allow for standard PHP code with property access logic to be written without the need for writing corresponding boilerplate get/set methods up front. | ||
+ | |||
+ | Also, when dealing with existing classes that are not written with traditional get/set methods for each property, this proposed change would make it easier to add in new functionality without the need for extensive refactoring of code that's using the classes in question. | ||
+ | |||
+ | |||
+ | ===== Changelog ===== | ||
+ | Initial draft. | ||
+ | |||
rfc/automatic_get_set_methods.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1