I'm in the middle of clarifying the Overloading section of the manual,
http://docs.php.net/manual/en/language.oop5.overloading.php. Some issues
and questions have come up and your insights will be helpful, please.
-
The docs say "All overloading methods must be defined as public." At
this point (in 5.2.1 and 5.3.0 snapshot) all visibility declarations are
ignored:class bug_43924 {
private function __call($name, $arguments) {
echo $name . "\n";
}
}$obj = new bug_43924;
$obj->ObjectContext();
Is this an oversight in the engine? Are there plans to have the parser
enforce the public declaration?
-
Along these lines, it would be an interesting new feature if one could
declare any visibility for the overloading methods and have the engine
observe them. This could allow people to use overloading for internal
calls but skip them for external calls. -
Some user comments say they find it helpful to have their __get()
methods return by reference. Doing so is allowed at this point. Is this
kosher? Will it remain so? -
The value of $name in __call() is case sensitive, but in the newly
added __callStatic() $name is lower case. Is this intentional? It seems
the two methods should have the same behavior. -
The new __callStatic() is neat. Thanks. Is there consideration of
adding Static versions of the other overloading methods?
Thanks,
--Dan
--
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
data intensive web and database programming
http://www.AnalysisAndSolutions.com/
4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409