Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66939 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80242 invoked from network); 4 Apr 2013 10:39:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Apr 2013 10:39:24 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.45 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.219.45 mail-oa0-f45.google.com Received: from [209.85.219.45] ([209.85.219.45:33020] helo=mail-oa0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F7/36-46468-B585D515 for ; Thu, 04 Apr 2013 05:39:24 -0500 Received: by mail-oa0-f45.google.com with SMTP id o6so2523763oag.4 for ; Thu, 04 Apr 2013 03:39:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=1grWK29pY52ewmd95h8BCt7XZNks3/7ig6pEn08c5PI=; b=p7/1z09KWjnPV4p7wthJzouoCr4j+wGCojHNfmvxELf6+OJEQU6QLoLVkc796bHs6p JdYf+4XYAugGpHH581gHoH+8a+1JgTncYdrG5lhNVBCpVtkV/85fGWrZOTVkblV4WV8a p2/ZV8HKBf4sWr0jc2mNpxigg/bQrbp3XscJk1zS8yzECtqkauAIDJYuMRgxbOc8g5Ig oaLE3uYXb6R6CgtBuGtakyKV8tOtVqcYCCKY3oJr9dlK2g6KzGf+G2M7vGDPTz00kb03 iJeV5eHERcDkb1jlU+ld3GbAAxY6Y9U7BJZZoo9O8EWen+X1qkLO1gIp/fDA3qaaqNfr snBQ== MIME-Version: 1.0 X-Received: by 10.60.144.226 with SMTP id sp2mr3546404oeb.64.1365071961396; Thu, 04 Apr 2013 03:39:21 -0700 (PDT) Received: by 10.182.49.136 with HTTP; Thu, 4 Apr 2013 03:39:21 -0700 (PDT) In-Reply-To: <515C8670.7030400@php.net> References: <515C8670.7030400@php.net> Date: Thu, 4 Apr 2013 12:39:21 +0200 Message-ID: To: Joe Watkins Cc: PHP internals , Sara Golemon Content-Type: multipart/alternative; boundary=047d7b5d2ba45a1c0504d986957f Subject: Re: [PHP-DEV] [RFC] Simplified Array API for extensions From: nikita.ppv@gmail.com (Nikita Popov) --047d7b5d2ba45a1c0504d986957f Content-Type: text/plain; charset=ISO-8859-1 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 --047d7b5d2ba45a1c0504d986957f--