Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87186 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29740 invoked from network); 15 Jul 2015 13:44:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jul 2015 13:44:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.215.10 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.215.10 mail.experimentalworks.net Received: from [217.114.215.10] ([217.114.215.10:60000] helo=mail.experimentalworks.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2F/C4-27477-6A366A55 for ; Wed, 15 Jul 2015 09:44:07 -0400 Received: by mail.experimentalworks.net (Postfix, from userid 1003) id AC48A402F9; Wed, 15 Jul 2015 15:44:03 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on km31408.keymachine.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=4.0 tests=ALL_TRUSTED autolearn=unavailable autolearn_force=no version=3.4.0 X-Spam-HAM-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Received: from [192.168.2.34] (ppp-93-104-5-249.dynamic.mnet-online.de [93.104.5.249]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: johannes@schlueters.de) by mail.experimentalworks.net (Postfix) with ESMTPSA id E50EF402F9; Wed, 15 Jul 2015 15:44:01 +0200 (CEST) Message-ID: <1436967838.8300.16.camel@kuechenschabe> To: Tjerk Meesters Cc: PHP Internals Date: Wed, 15 Jul 2015 15:43:58 +0200 In-Reply-To: References: Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-7Wqy3+R6sq2nIIeDBJzP" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Subject: Re: [PHP-DEV] Consolidation of Traversable and array operations From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) --=-7Wqy3+R6sq2nIIeDBJzP Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Wed, 2015-07-15 at 11:28 +0000, Tjerk Meesters wrote: > The most notable comment was that it would be nice to support Traversable > as well as arrays; instead of only supporting this for my own functions, > I've generalised this so that other functions can take advantage of this = as > well. These are the additions: >=20 > 1. A ZPP argument; the "t" (for traversable) argument type has been added > that checks for either an array or implementation of zend_ce_traversable. >=20 > 2. A generic iteration function, called php_traverse(); it accepts: > a. the zval* to iterate over, > b. a step-wise function that receives the value and key, and returns a > boolean that determines whether iteration should continue or not, > c. a traversal mode (only values, or keys and values), > d. a context that's sent to the step-wise function. I really like this concept to unify by access pattern, hiding the actual implementation! > 3. A concrete implementation of a step-wise iteration function, > php_traverse_until, that gets called as part of array_every() and > array_some(). I wonder if we can find a better naming scheme. For some array_ functions this will work, others not. This again feeds the "PHP is so inconsistent"-trolls. At the moment I'm leaning towards simply using every() and some_of() without reference to a type. Or maybe introduce, to restart the namespace-debate, php\every(), php\search(), php \someOf(), php\product(), etc. and deprecate array_search() etc. johannes --=-7Wqy3+R6sq2nIIeDBJzP Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQEcBAABAgAGBQJVpmOeAAoJEH3sTmn8nIPXH5kH/0sLSRoZwygqNeMLIpQRcDrm WqSXxvh6lTwnIPnZJuYQ4QR4LHnfJqqHULjcVEWUCln7zPVS5ZhPF0RRWj5UK8JI Hm/KbYhsBMmTA3oNYsUsE9himxSYSZ4kT1pkCLsP4y6zl10aJ4i4ixQkiMKL5A0b CvZwZeqYD95LSd8lF1NAt0wyWY5l4dFDOSskV26IJskx+dV9iPyUaWckKDHW9yEa 4RV21D//ZCLl3aTgvN8ONDjwIsJQ5GWZ3rqJXQiJMoFLe66QqdQ7wlUAh1ulKvle N5kvJgBoilJ+jq+FhxoPY03Evc0Y5mamulgr9Q+ZmzXpFN2maFvp3frXvwqqyD0= =RgXC -----END PGP SIGNATURE----- --=-7Wqy3+R6sq2nIIeDBJzP--