Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93943 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30888 invoked from network); 13 Jun 2016 17:11:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jun 2016 17:11:50 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 77.244.243.82 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 77.244.243.82 mx101.easyname.com Received: from [77.244.243.82] ([77.244.243.82:45369] helo=mx205.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AF/DF-12403-459EE575 for ; Mon, 13 Jun 2016 13:11:49 -0400 Received: from cable-81-173-133-15.netcologne.de ([81.173.133.15] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1bCVOr-000156-0F; Mon, 13 Jun 2016 17:11:45 +0000 Reply-To: internals@lists.php.net References: <8284FE1F-70EE-4DB6-A945-0C57A4C99DCC@trowski.com> <16ef864f-8378-1af3-ddfb-21dc583a4b4a@gmx.de> To: Levi Morrison , Christoph Becker Cc: Aaron Piotrowski , PHP internals Message-ID: Date: Mon, 13 Jun 2016 19:11:31 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5v9dqeTXXVc2b57Rg1QwlF1t89jisvVxS" X-ACL-Warn: X-DNSBL-BARRACUDACENTRAL Subject: Re: [PHP-DEV] Re: [RFC] Iterable From: php@fleshgrinder.com (Fleshgrinder) --5v9dqeTXXVc2b57Rg1QwlF1t89jisvVxS Content-Type: multipart/mixed; boundary="MPngfVg8C0r9U1MBmrW2WEQ649UuvQI3F" From: Fleshgrinder Reply-To: internals@lists.php.net To: Levi Morrison , Christoph Becker Cc: Aaron Piotrowski , PHP internals Message-ID: Subject: Re: [PHP-DEV] Re: [RFC] Iterable References: <8284FE1F-70EE-4DB6-A945-0C57A4C99DCC@trowski.com> <16ef864f-8378-1af3-ddfb-21dc583a4b4a@gmx.de> In-Reply-To: --MPngfVg8C0r9U1MBmrW2WEQ649UuvQI3F Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 6/13/2016 5:59 PM, Levi Morrison wrote: > My opinion is contrary: the union type is the cleaner solution as it > does not require special casing machinery in the engine. >=20 I am a huge fan of the union types but this is such a common requirement that it requires a pseudo compound type in my opinion. The special casing in the engine is trivial: https://github.com/php/php-src/pull/1941 I also hope that this allows expansion in internals and enable us to rewrite existing functions from array to iterable and directly iterate them without special casing. Furthermore I argue the we need more of those pseudo compound types that are special in internals and userland and I might implemented them if I am ever going to be granted some Karma: number :=3D is_numeric || is_int || is_float stringable :=3D is_string || method_exists(__toString) These three things cannot even be easily expressed with union types. (Well, the last one can if one creates a Stringable interface and you end up having string|Stringable :P) --=20 Richard "Fleshgrinder" Fussenegger --MPngfVg8C0r9U1MBmrW2WEQ649UuvQI3F-- --5v9dqeTXXVc2b57Rg1QwlF1t89jisvVxS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXXulMAAoJEOKkKcqFPVVrTfUP/0H4W90/in2SvsXA/sZ6MwOD 4bikfIknL46tHpocNdx3EGeqppJoUcPFQZr0fp37aS8eOf3nw12OesMN92R9oct/ GunVRb1lTLXQeL8o2497bouRqi5pAOkNRmufwkJEYFqxUS5yeWY+e7SHY7xkf1Ql gXB9oq8dHIdrAsDFQBivoaukdxGANgu26up0FyI5VCgq9/G2AL7+dN84rZQu7TXg cC1AgI3bYUDigWoAtQS6KvqiBvzvyIGVxOJy0ypqPo/dfpxuTjhr/xB6rOG0+ZhK aRAkZasfHacgM4UJUOIGS5hmUXsKUAFefJovNrG/rUtesSqpWZoPevX76lb+9RJ7 6TBfgTwV5i9MBCOqqnU78u1iOZInXRIjgtDTqKopbNh1ijtZj3NkT27MP5YW8LiM hLJBU0pEhSU9jLL1/mzIPKFzpw7dQHOMzBni8RD9IVtt/hezJzhHfT2IRGmrSmSx L7OYYAix2jE9M+fPsSkaOcPUYsed3q/wHkBoPvu1S8XV/6pn0BWbmBXw1FWdL/x8 HRW9UpuhGRmpwGWB/LLyvai2WsZyERnzdWsAxjuQIJ85k36hqcinVrVfpa2Swgzw ZK5mP5/7UyvtAiIUMb6ucKWKhWylA3XQtbTnCJewKzhUKHRWVr68Q/k4ZDDbWDC8 FlkuQHcpd4IVdl5SLedL =iu39 -----END PGP SIGNATURE----- --5v9dqeTXXVc2b57Rg1QwlF1t89jisvVxS--