Re: [RFC] Mixed Typehint

From: Date: Tue, 19 Dec 2017 15:28:29 +0000
Subject: Re: [RFC] Mixed Typehint
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-101383@lists.php.net to get a copy of this message
On Tue, Dec 19, 2017 at 4:47 AM, Andreas Hennings <andreas@dqxtech.net> wrote: > On 19 December 2017 at 08:06, Fleshgrinder <php@fleshgrinder.com> 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.

« previous php.internals (#101383) next »