Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66940 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21611 invoked from network); 4 Apr 2013 12:48:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Apr 2013 12:48:17 -0000 Authentication-Results: pb1.pair.com header.from=pthreads@pthreads.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=pthreads@pthreads.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pthreads.org from 209.85.212.42 cause and error) X-PHP-List-Original-Sender: pthreads@pthreads.org X-Host-Fingerprint: 209.85.212.42 mail-vb0-f42.google.com Received: from [209.85.212.42] ([209.85.212.42:65534] helo=mail-vb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3A/F7-16978-F867D515 for ; Thu, 04 Apr 2013 07:48:16 -0500 Received: by mail-vb0-f42.google.com with SMTP id p12so1276145vbe.29 for ; Thu, 04 Apr 2013 05:48:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:x-originating-ip:in-reply-to:references :date:message-id:subject:from:to:cc:content-type:x-gm-message-state; bh=CiffjaP5tE+XVN95RAqm+FUytvJ2lbv855Q5aG7KXyg=; b=KIKXVPnBljnRrvFh+2B/OkI+HD4N7nwBE3iGiDGAEgaZGI8nIrCurIcs1dMkGMMeNK fpYl+G2Ab6EoC9DbMRkkiWD4Xk2cDVWCEKy+uXYl3veylOjHXfAT1GmrtCiFpFWwRms+ LJ4WHdh7lfIrVI4nXYwkP1cXgAbtit/GdV+iYwKUojvP0y8ehFAfzyJPNKVSY/vf3ecU Q6QpqQDy/6GwLCrIJiZVIVnw7fNoRgQ5QkrP+d14gtjiBxBrsRNidAjZAmOQAHco4wum CsVyIWIQCEsgpNUwLKhcFQaGNO+yDyYbxZ3NdTeAm0M6GoHExrztxtGc4mcJL7PxlcWd VNIg== MIME-Version: 1.0 X-Received: by 10.52.20.177 with SMTP id o17mr3984279vde.17.1365079693104; Thu, 04 Apr 2013 05:48:13 -0700 (PDT) Received: by 10.220.239.14 with HTTP; Thu, 4 Apr 2013 05:48:12 -0700 (PDT) X-Originating-IP: [149.254.51.143] In-Reply-To: References: <515C8670.7030400@php.net> Date: Thu, 4 Apr 2013 13:48:12 +0100 Message-ID: To: Nikita Popov Cc: Joe Watkins , PHP internals , Sara Golemon Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQkrYKMLg+R3ai61qHWgtC1H5KIs5prGQuW+E5dEB2t8o2wd7+A/j7TLCIQgCg8p46CKU3l0 Subject: Re: [PHP-DEV] [RFC] Simplified Array API for extensions From: pthreads@pthreads.org (Joe Watkins) 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 wrote: > On Wed, Apr 3, 2013 at 9:43 PM, Joe Watkins 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 >