On Tue, Dec 19, 2017 at 4:47 AM, Andreas Hennings <[email protected]> wrote:
> On 19 December 2017 at 08:06, Fleshgrinder <[email protected]> wrote:
>> What is really needed are `scalar`, `number`, union types, intersection
>> types, and all that together with generics.
>
> Do we have ongoing discussions or RFCs for those already?
> I know we have one for generics, which seems somehow stuck,
> https://wiki.php.net/rfc/generics
No. Work is quietly being done on parameterized types (aka generics) here:
https://github.com/morrisonlevi/php-src/tree/parameterized_traits
There really isn't a lot to discuss at this stage anyway; the
technical implementation is paramount.
> What would "scalar" mean exactly? string+int+float?
Scalar and number are just ways of naming certain union types which
feature was already declined. Maybe a single RFC which targets both
union and intersection types would pass. Our `is_scalar` function
returns true for integer, float, string or boolean; a scalar type
should mirror that definition: int | float | string | bool.
> I would sometimes like a string+int, for "everything that can be an array
> key".
This is just another named union for `string | int`.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php