Re: Re: Any interest in a list type?
| From: | Matthew Brown | Date: | Tue, 21 Apr 2020 21:06:21 +0000 |
| Subject: | Re: Re: Any interest in a list type? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109764@lists.php.net to get a copy of this message | ||
>
> Making a special kind of array _value_ that must stay a “list” sounds
> more problematic… I think without automatic casting back and forth from
> regular “arrays” it might play badly with existing code, but then there
> would be no point…
>
Makes sense – then conversion from lists to arrays would happen the same way
$some_int += $some_float
converts $some_int to a float.
_If_ there was a list type then it would make sense to add a corresponding
is_list runtime check, and users would be able to typehint their functions
as returning a list, and get an error if the function actually returned a
(non-list) array.