Re: [PHP-DEV] RFC - Array Of for PHP 7

2017-11-04 Thread Andrea Faulds
Hi Mark, Mark Randall wrote: 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

Re: [PHP-DEV] RFC - Array Of for PHP 7

2017-11-02 Thread 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

Re: [PHP-DEV] RFC - Array Of for PHP 7

2017-11-02 Thread Andrea Faulds
Hi, Mark Randall wrote: On 01/11/2017 01:36, Andrea Faulds wrote: Thank you for bringing this up. The introduction of nullables means that the type[] syntax is problematic and should probably be avoided now. As you say, there is an issue of ambiguity as to whether it would be interpreted as

Re: [PHP-DEV] RFC - Array Of for PHP 7

2017-11-02 Thread Michael Morris
On Thu, Nov 2, 2017 at 3:21 PM, Larry Garfield wrote: > > While I normally strongly agree with supporting all traversables, not > just arrays, in this case I don't think it works. Hmm.. You're right. Traversables would be best served by having another method to indicate

Re: [PHP-DEV] RFC - Array Of for PHP 7

2017-11-02 Thread Larry Garfield
On 11/01/2017 11:31 PM, Michael Morris wrote: > Drupal 8 accomplishes this through assert() and a helper class. > > function foo ( array $a ) { > assert( Inspector::assertAllStrings( $a )); > } > > This could be improved by having an collectionof operator similar to the > instanceof operator. >

Re: [PHP-DEV] RFC - Array Of for PHP 7

2017-11-02 Thread Mark Randall
On 01/11/2017 01:36, Andrea Faulds wrote: Thank you for bringing this up. The introduction of nullables means that the type[] syntax is problematic and should probably be avoided now. As you say, there is an issue of ambiguity as to whether it would be interpreted as (?int)[] or ?(int[]).

Re: [PHP-DEV] RFC - Array Of for PHP 7

2017-11-01 Thread Michael Morris
Drupal 8 accomplishes this through assert() and a helper class. function foo ( array $a ) { assert( Inspector::assertAllStrings( $a )); } This could be improved by having an collectionof operator similar to the instanceof operator. function ( array $a ) { assert( $a collectionof string ); }

Re: [PHP-DEV] RFC - Array Of for PHP 7

2017-11-01 Thread Rowan Collins
On 31 October 2017 17:37:17 GMT+00:00, Levi Morrison wrote: > - Our current infrastructure requires us to check every element of >the array for conformance. While undesirable I believe this can be >optimized away in the future if we care enough, and therefore not a >show-stopper.

Re: [PHP-DEV] RFC - Array Of for PHP 7

2017-10-31 Thread Andrea Faulds
Hi Levi, Levi Morrison wrote: My thoughts on the RFC: - The syntax `typename[]` is a poor. Consider how nullability might bind `?int[]`. Is that `(?int)[]` or `?(int[])` ? Here are some variants that do not have this issue: [?int] and ?[int] array and ?array Thank you for bringing

Re: [PHP-DEV] RFC - Array Of for PHP 7

2017-10-31 Thread Levi Morrison
My thoughts on the RFC: - The syntax `typename[]` is a poor. Consider how nullability might bind `?int[]`. Is that `(?int)[]` or `?(int[])` ? Here are some variants that do not have this issue: [?int] and ?[int] array and ?array - Our current infrastructure requires us to check every

Re: [PHP-DEV] RFC - Array Of for PHP 7

2017-10-27 Thread Rowan Collins
On 25 October 2017 22:52:37 BST, Dan Ackroyd wrote: >Although 'array of' as well as full blown generics are popular ideas, >I'm pretty certain the RFC failed due to the type check on the array >happening every time the 'array of' was passed from one function to >another,

Re: [PHP-DEV] RFC - Array Of for PHP 7

2017-10-25 Thread Dan Ackroyd
On 25 October 2017 at 21:41, Michał Harężlak wrote: > Hallo, > > I think this RFC should be voted again. Although 'array of' as well as full blown generics are popular ideas, I'm pretty certain the RFC failed due to the type check on the array happening every time the

Re: [PHP-DEV] RFC - Array Of for PHP 7

2017-10-25 Thread Sara Golemon
On Wed, Oct 25, 2017 at 4:41 PM, Michał Harężlak wrote: > I would like to create a RFC for PHP 7, but the same RFC was created and > declined 3 years ago for PHP 5.4. PHP 7 support much better type hinging so > I think this RFC should be voted again. > > What should I do?

[PHP-DEV] RFC - Array Of for PHP 7

2017-10-25 Thread Michał Harężlak
Hallo, I would like to create a RFC for PHP 7, but the same RFC was created and declined 3 years ago for PHP 5.4. PHP 7 support much better type hinging so I think this RFC should be voted again. What should I do? Should I create the RPF in common way? Link to mentioned RFC: