Re: Constant and expression ?
| From: | Frederic Hardy | Date: | Wed, 09 Jun 2010 08:51:36 +0000 |
| Subject: | Re: Constant and expression ? | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-48696@lists.php.net to get a copy of this message | ||
On 05/19/2010 14:43, Johannes Schlüter wrote:
Hi, On Wed, 2010-05-19 at 13:03 +0200, fqqdk wrote:Very good news. Best regards, Fred. -- ======================================================================== Frédéric Hardy : Architecte d'application/Admin. système/Ergonome ========================================================================2010/5/19 Tjerk Anne Meesters<datibbaw@php.net>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.I wrote a small article that gives an idea of the speed differences: http://shwup.blogspot.com/2010/04/about-constants.htmlHow 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 ?