While this patch does add convienence at times, I don't think the benefit is great enough to blur the lines between class and object properties/methods. As was stated in the "goto" discussions, the language designers have somewhat of a responsibility to promote proper coding practices (which should also include standards to some extent).
Bob Silva -----Original Message----- From: Andi Gutmans [mailto:[EMAIL PROTECTED] Sent: Monday, October 04, 2004 6:03 PM To: Marcus Boerger; [EMAIL PROTECTED] Subject: Re: [PHP-DEV] Dynamic class constants Hi Marcus, The patch looks fine. Before we commit I just want to make sure that we make sure we don't get bitten by this change sometime in the future. In general, the idea is that writing $obj:: will be like doing class::. It can be useful in places such as Factories and other instances. Although Marcus' patch is only for constants it would make sense to at some stage also support this notation for static properties, ala, $obj::$static_var. What's important to note that this means that $obj:: would always evaluate to class:: and not to $obj_as_string:: Personally I think this makes sense but I'd like people to think about it. So it'd mean that: $obj::$static_var access static property $static_var of $obj's class $obj::method() access static method method() of $obj's class $obj::CONST accesses constant of $obj's class. I haven't checked if this kind of implementation can be done and if there aren't any ambiguities but this is the general idea. Feedback welcome. Andi At 07:23 PM 10/3/2004 +0200, Marcus Boerger wrote: >Hello internals, > > this patch allows to access class constants by objects. >If noone objects i'll commit it on tuesday. > >Example: > >class Test >{ > const Foo = 'Bar'; >} > >$obj = new Test; > >var_dump($obj::Foo); > >-- >Best regards, > Marcus >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php