The idea was to avoid treating the object as an array of properties
where there is another option. Where there isn't an option the objects
properties have to be accessed as an array dont they?

On 4/4/13, Nikita Popov <nikita....@gmail.com> wrote:
> On Wed, Apr 3, 2013 at 9:43 PM, Joe Watkins <krak...@php.net> wrote:
>
>> Hi Sara,
>>
>> A logical extension of this idea would be to drop _array_ and cover
>> objects too, one uniform everything API is very appealing, and way easier
>> to document properly.
>>
>> Something alone the lines of:
>>
>> static inline
>> zend_bool php_exists(zval *pzval, const char *key) {
>>         switch (Z_TYPE(pzval)) {
>>             case IS_ARRAY:
>>                 return zend_symtable_exists(Z_ARRVAL_**P(pzval), key,
>> strlen(key) + 1);
>>
>>             default: {
>>                 if (Z_OBJ_HT_P(pzval)->has_**property) {
>>                     return Z_OBJ_HT_P(pzval)->has_**property(
>>                         pzval, key, strlen(key) + 1, 2 NULL TSRMLS_CC
>>                     );
>>                 } else {
>>                     return zend_symtable_exists(
>>                         Z_OBJPROP_P(pzval), key, strlen(key) + 1);
>>                 }
>>             }
>>         }
>> }
>>
>> Just a thought ..
>>
>
> Strong -1 on anything that tries to treat objects as if they were arrays of
> properties. I think much damage has already been done by using object
> properties as an array in some places and we should not go further down
> that road. I have no problem with nice APIs for object properties access,
> but please, please do not mix both.
>
> Nikita
>

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to