Hello Luna, Sunday, March 28, 2004, 6:56:00 PM, you wrote:
> "Andi Gutmans" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> At 10:07 AM 3/15/2004 -0500, Hans Lellelid wrote: >> > ... >> >You must now use self::MY_CONST to reference the class constant. While I >> >can see that the pre-RC1 behavior would not provide a way to access global >> >constant if class had const of same name ... I figured I'd ask anyway >> >whether this change is intended or a side-effect of some other fix. I >> >fall into the category of people who were really enjoying not having to >> >specify self:: before (so now I have a lot of code to fix, apparently). >> ... >> I fixed it intentionally. That piece of code was left over from the days of >> our broken namespaces implementation where we would do two lookups. Methods >> were fixed a long time ago but we forgot to remove the old code from constants. >> >> Andi > Well, I guess there is no easy solution, but anyhow, this is still very unfortunate. > The basic "Don't Repeat Yourself" (or "DRY") principle, which could forunately > eliminate the > function Classname() { // constructor > syntax replacing it with the much cleaner and saner __construct (THANKS!!!), > now fails to prevent creeping in of another sort of harmful hardcoded redundancy > to our code... > I'd say I'd rather pay the price of any double lookup any day than loading my code > with useless duplication of information. > As a cheap and effective compromise, would that be a possible to introduce something > like a > __thisclass > keyword so that those of us who are concerned about code duplication could avoid > this newly introduced unnecessary repeating of class names when qualifying consts > within the defining class? > This way (writing __thisclass::MYCONST instead of MyParticularClassName::CONST > we could freely decide to favor clean style, or performance, depending on the > specific > situation. No need for that we have 'self': php -r 'class c { const c="Hello\n"; static function f() { return self::c; }} echo c::f();' -- Best regards, Marcus mailto:[EMAIL PROTECTED] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php