Hi!
> note that we have this functionality already:
>
> $ php -r 'class A { const C = FOO; } define("FOO", 23); echo A::C;'
> 23
>
> The first fetch will resolve that.
This is true, but what happens is that "FOO" is stored and then resolved
on fetch with direct lookup. Now, if C = M_PI/2, what would we store? We
could theoretically store string "M_PI/2" and somehow "evaluate" it, or
we could even translate:
class A { const C = M_PI/2; }
to:
class A { const C = __definition_of_A_C; }
function __define_A_C() { define(__definition_of_A_C, M_PI/2); }
and when we encounter __definition_of_A_C for the first time we run
__define_A_C() and take the value of __definition_of_A_C - but I imaging
that would seriously complicate the code, especially if we think about
how to handle exceptional situations there...
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php