Dear Bill,
I am worried that when late static binding finally appears in PHP 6 that
some disturbance may pass through the Zend Framework.
It may do this
unless either late static binding is incorporated into PHP 5.2's
successor so that the framework can up its requirements or
unless code for the final beta takes account of late static binding
wherever it may be useful.
For one example I am sure there are many people still wondering what
happened to 'Zactiverecord' . As Joshua Eichorn pointed out
-http://blog.joshuaeichorn.com/archives/2006/01/09/zactiverecord-cant-work/
<http://www.ds-o.com/exit.php?url_id=153&entry_id=53> - and as again
echoed by Mike Lively -
http://www.digitalsandwich.com/archives/53-Late-Static-Binding-in-PHP.html#comments
- late static binding is necessary for the zend framework webcast
demonstration to work.
While most people discussing the framework on the lists don't seem too
fussed about the necessity of a 'Rubyish' Active Record object I feel
that if you held a poll on the Wiki homepage asking the question "Would
you like to see an active record implementation in the Zend Framework?
Yes or no?" many people may come out of the woodwork with a positive
answer.
Why not try to talk php developers into incorporating late static
binding into PHP 5.2's successor? At the very least it would be good if
someone could start a laboratory proposal based on the new static
keyword proposed for PHP 6 at the Paris, November 11th and 12th, 2005
PHP developers meeting:
*" Issue*: Currently, the following script will print "A:static2":
<?php
class A {
static function staticA() {
self::static2();
}
static function static2() {
echo "A::static2\n";
}
}
class B extends A {
static function static2() {
echo "B::static2\n";
}
}
B::staticA();
?>
*Discussion*: Currently there is no way do "runtime evaluating" of
static members so that we can call B::static2() from A::staticA() and
this is a useful feature. In order to implement this we need a new
keyword to allow for this. As we do not want to introduce yet another
reserved word the re-use of "static" was suggested for this.
The same example, but now with the call to "self::static2()" replaced
with "static::static2()", will then print "B::static2".
*Conclusions*:
1. We re-use the "static::" keyword to do runtime evaluation of statics.
2. Marcus prepares an implementation suggestion. *"*
I am not a developer but a user looking in from the outside. I lack the
skills and wherewithal to be able to contribute. However, I hope that
this post may stimulate some discussion. Perhaps the suggested poll
could be set up to assess how list watchers (as distinct from
contributors) feel.
Allan Vernon