Re: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_builtin_functions.c
| From: | Zeev Suraski | Date: | Sun, 10 Apr 2005 20:45:23 +0000 |
| Subject: | Re: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_builtin_functions.c | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-15942@lists.php.net to get a copy of this message | ||
I think Andi hit the nail right on the head.
PHP was never about perfection, it was and should continue to be about getting things done. So having X_exists() doesn't immediately mean we also have _exists() methods for Y and Z too, especially if they go against guidelines which we've established, and especially since it doesn't buy us anything that couldn't be achieved (easily) before. IMHO, we could do with placing some self-imposed limit on the over-architecture of PHP, and yes, even SPL.
Zeev
At 02:10 09/04/2005, Andi Gutmans wrote:
Marcus, PHP is being used by millions of people and it is irrelevant whether you think that const was wrong from the beginning or not, because we won't fix something which has been around probably since 1995. Restating that over and over is not productive as we should support what has been around for a long time. And mind you, PHP is quite useful the way it is. Talking about making PHP hard, a lot of the OOP things you are pushing are doing exactly that, and will result in PHP to loose it's ease of use. A lot of the SPL stuff takes this approach and goes very far into the Java-realm which is precisely why so many ppl left Java for PHP in the first place. Simplicity. We don't have to and shouldn't overcomplicate things. Now property_exists() doesn't fall into that category and isn't quite related. Frankly, I couldn't care too much about it except for the fact that I know there will be other *_exists() after that and we should follow our rules and try to work by our rules for new things. If every time, we asked someone to follow the new rules would point at all the past wrong doings then we wouldn't get anywhere. Everyone who has been involved on PHP development for a long time knows exactly where it came from and why/when we decided to be more structured. The decision to preserve BC doesn't mean we have to create new stuff in the spirit of old. And we're talking about a function which the millions of PHP servers have done without forever. Andi At 07:15 PM 4/8/2005 +0200, Marcus Boerger wrote:Hello Andi, erm yes i could put it to spl as a convenience function prefixed by 'spl_' and we could also add a namespace for class functions 'class_' or one for the reflection api (whatever that might be) or we could put those as static methods into class 'Reflection'. However all of these makee it harder since having 'class_exists', 'function_exists', 'method_exists' simply screems for having 'property_exists' also. Why must we always make php so hard by preventing not to have it consitent? I know the 'global namespace' argument. But like many other things it is to late to enforce that rule...many years to late. And don't ask me about consts. They were wrong right from the beginning. we should have read only proeprties instead and be done. marcus Friday, April 8, 2005, 6:53:33 PM, you wrote:It's vital? Come on, you can convince me that it's nice to have, sure. But vital? What can it do which you can do with reflection API? If the name is sexier than you can write your own PHP function.At 06:36 PM 4/8/2005 +0200, Marcus Boerger wrote:-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.phpHello Andi, Marcus, method_exists() is quite vital to help where the type hinting fail. Type hinting fail because it leads to a fatal error which is uncatchable and the code cannot react on this. Therefore, for me type hinting is kind of useless since I cannot catch my bugs by executing some codeHello Andrey, same goes for property_exists() which is why i added it. marcus Friday, April 8, 2005, 6:31:48 PM, you wrote:the data passed is not what the function/method expects. Reflection API is overkill to write everywhere and has to be wrapped to something which at the end will simulate method_exists().wheneverThanks for you attention, AndreyMarcus Boerger wrote:likeHello Andi, to this i only agree under two conditions. First we remove otherinstancesmethod_exists() too and second we fix handling of implicit public and dynamic properties. Unless the second is done i see such a function as relative important and don't like to use reflection overhead always. regards marcus Friday, April 8, 2005, 6:00:03 PM, you wrote:Marcus,There was a long discussion about this a few months ago. The conclusion was to use the reflection_api for the very fewidea towhere isset() isn't relevant. Although we have done bad stuff in the past, it's also not a goodfor thecontinue polluting the global namespace. Please revert this patch. FYI, all the other requests for additional functions like class_constant_exists() should also be reflection API. It's best1=1.language.Thanks, AndiAt 01:33 PM 4/8/2005 +0000, Marcus Boerger wrote:helly Fri Apr 8 09:33:17 2005 EDTModified files:/ZendEngine2 zend_builtin_functions.cLog: - Add property_exits() http://cvs.php.net/diff.php/ZendEngine2/zend_builtin_functions.c?r13:23:38 2005262&r2=1.263&ty=uIndex: ZendEngine2/zend_builtin_functions.c diff -u ZendEngine2/zend_builtin_functions.c:1.262 ZendEngine2/zend_builtin_functions.c:1.263 --- ZendEngine2/zend_builtin_functions.c:1.262 Mon Apr 409:33:15 2005+++ ZendEngine2/zend_builtin_functions.c Fri Apr 8- ----+@@ -17,7 +17,7 @@ +-----------------------------------------------------------------Exp $ */*/ -/* $Id: zend_builtin_functions.c,v 1.262 2005/04/04 17:23:38 stasExp $ */+/* $Id: zend_builtin_functions.c,v 1.263 2005/04/08 13:33:15 helly#include "zend.h" #include "zend_API.h" @@ -43,6 +43,7 @@ static ZEND_FUNCTION(get_class); static ZEND_FUNCTION(get_parent_class); static ZEND_FUNCTION(method_exists); +static ZEND_FUNCTION(property_exists);