On 05/19/2010 14:43, Johannes Schlüter wrote:
Hi,
On Wed, 2010-05-19 at 13:03 +0200, fqqdk wrote:
2010/5/19 Tjerk Anne Meesters<datib...@php.net>
I wrote a small article that gives an idea of the speed differences:
http://shwup.blogspot.com/2010/04/about-constants.html
Unfortunately this doesn't tell, what you actually measured. And note
that as of 5.3 the "class constant" syntax can be used in the global
scope, too.
How about extending the usage of the 'final' keyword to support a java-like
syntax?
No. We have a const keyword. Rather somebody interested in this topic
might try to come up with a patch to at least allow "constant
expressions" this should serve most needs.
constant expressions might be stuff like __DIR__.'/foobar.php' or
CONST_A | CONST_B.
We already have two steps in the constant resolution for constructs like
these:
php> class A { const C = FOOBAR; }
php> define('FOOBAR', 42);
php> echo A::C;
42
See zval_update_constant_ex in zend_API.c as a starting point. While
such an approach would also require some parser work and some clever
idea where/how to store the expression to be evaluated etc.
johannes
So, it's possible ?
Very good news.
Best regards,
Fred.
--
========================================================================
Frédéric Hardy : Architecte d'application/Admin. système/Ergonome
========================================================================
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php