Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101037 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49563 invoked from network); 3 Nov 2017 05:22:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Nov 2017 05:22:13 -0000 X-Host-Fingerprint: 5.67.70.122 0543467a.skybroadband.com Received: from [5.67.70.122] ([5.67.70.122:17668] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 11/08-09857-30DFBF95 for ; Fri, 03 Nov 2017 00:22:12 -0500 Message-ID: <11.08.09857.30DFBF95@pb1.pair.com> To: internals@lists.php.net References: <14.52.09857.F0B0BF95@pb1.pair.com> Date: Fri, 3 Nov 2017 05:22:08 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Posted-By: 5.67.70.122 Subject: Re: [PHP-DEV] RFC - Array Of for PHP 7 From: markyr@gmail.com (Mark Randall) On 03/11/2017 02:27, Andrea Faulds wrote: > Your proposed objects would not be usable everywhere an array is, > because they're not arrays, and by converting to an array you lose the > type info, so we still have to iterate over the whole thing to type > check. This would be significantly less useful than an actually typed > array. I can see some benefit to it, but I'm not sure it's worth the > effort. Thanks for the reply. So if I am following right, would your goal in the short-to-mid term at least be to attach type information inside the HashTable, or as part of the zval value? I may be pulling this out our my arse of course, but does the nature of an array not mean that the individual values inside can be used as references and potentially break the type restrictions and require all-item checking again? $t1 = array([ 'hello', 'goodbye']); $val = &$t1[1]; $val = 1; -> [ 'hello', 1] I did take a look in zend_types.h half expecting to see a pointer to an optional structure defining an indirect function call + argument to be called whenever the zval_value was about to be changed, but if it's in there, I missed it. -- Mark Randall