cvs: ZendEngine2 /RFCs 004.txt
| From: | Sebastian Bergmann | Date: | Tue, 11 Jun 2002 08:06:02 +0000 |
| Subject: | cvs: ZendEngine2 /RFCs 004.txt | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-162@lists.php.net to get a copy of this message | ||
sebastian Tue Jun 11 04:06:02 2002 EDT
Modified files:
/ZendEngine2/RFCs 004.txt
Log:
Add __delegate().
Index: ZendEngine2/RFCs/004.txt
diff -u ZendEngine2/RFCs/004.txt:1.1 ZendEngine2/RFCs/004.txt:1.2
--- ZendEngine2/RFCs/004.txt:1.1 Thu Jun 6 17:13:39 2002
+++ ZendEngine2/RFCs/004.txt Tue Jun 11 04:06:02 2002
@@ -1,6 +1,6 @@
Title: Delegation
(a/k/a. Object-Based Inheritance)
-Version: $Revision: 1.1 $
+Version: $Revision: 1.2 $
Status: draft
Maintainer: Sebastian Bergmann <sb@sebastian-bergmann.de>
@@ -74,3 +74,34 @@
where locally defined or inherited from a superclass. The difference
to the dynamic delegation is that once the delegatee object is set,
it cannot be changed.
+
+
+Default Delegation
+
+ Syntax / Example
+
+ <?php
+ class Foo {
+ function __delegate($name, $parameters = array()) {
+ echo $name;
+ }
+ }
+
+ $foo = new Foo;
+ $foo->bar(); /* prints "bar" */
+ ?>
+
+ Semantics / Synopsis
+
+ If a class has a __delegate() method, it is called whenever a
+ method on an object of this class is called that is
+
+ * Not defined in the class.
+
+ * Not provided by a delegatee object.
+
+ The __delegate() method is called with the name and parameters
+ of the method call.
+
+ This supersedes / obsoletes similar functionality introduced in
+ Zend Engine 1 by ext/overload.