Re: [PHP-DEV] Mixed type-hint

2019-02-08 Thread Marcos Passos
It is just a (draft) proposal. Anyway, the RFC does not force you to declare a mixed type but brings an option for who wants to. On Fri, Feb 8, 2019 at 13:03 Robert Korulczyk wrote: > There is no reason to introduce `mixed` type-hint if it does not provide > any validation and works the same as

Re: [PHP-DEV] Mixed type-hint

2019-02-08 Thread Robert Korulczyk
> Could you clarify on a use-case for changing the semantics of `mixed`? For example storage which does not allow to store null. Like simple cache which treats null as "miss", so it is not able to cache null as value. Obviously it is not a deal breaker and use case is quite rare anyway, but

Re: [PHP-DEV] Mixed type-hint

2019-02-08 Thread Dan Ackroyd
On Fri, 8 Feb 2019 at 07:20, Rasmus Schultz wrote: > > Regarding the mixed type-hint RFC: > > https://wiki.php.net/rfc/mixed-typehint The status of the RFC is in "In Draft" and you don't appear to be the author of the RFC. It is not appropriate for someone other than the author to start the

Re: [PHP-DEV] Mixed type-hint

2019-02-08 Thread Girgias
On Fri, 8 Feb 2019 at 13:13, Robert Korulczyk wrote: > Sounds like an arbitrary interpretation. Treating `?mixed" as "top type" > (including null) would be more practical and consistent with other > type-hints. > > Regards, > Robert Korulczyk > The whole PHP Documentation is based around the

Re: [PHP-DEV] Mixed type-hint

2019-02-08 Thread Marco Pivetta
On Fri, 8 Feb 2019, 13:13 Robert Korulczyk Sounds like an arbitrary interpretation. Treating `?mixed" as "top type" > (including null) would be more practical and consistent with other > type-hints. > The PHP ecosystem (libraries) already uses `mixed` as a type including `null`. You can survey

Re: [PHP-DEV] Mixed type-hint

2019-02-08 Thread Robert Korulczyk
Sounds like an arbitrary interpretation. Treating `?mixed" as "top type" (including null) would be more practical and consistent with other type-hints. Regards, Robert Korulczyk W dniu 08.02.2019 o 12:47, Marco Pivetta pisze: > `mixed` is the "top" type, which means that it contains anything at

Re: [PHP-DEV] Mixed type-hint

2019-02-08 Thread Marco Pivetta
`mixed` is the "top" type, which means that it contains anything at all. See https://en.wikipedia.org/wiki/Top_type On Fri, 8 Feb 2019, 12:45 Robert Korulczyk What definition? > > Regards, > Robert Korulczyk > > W dniu 08.02.2019 o 12:37, Marco Pivetta pisze: > > Mixed includes null by

Re: [PHP-DEV] Mixed type-hint

2019-02-08 Thread Robert Korulczyk
What definition? Regards, Robert Korulczyk W dniu 08.02.2019 o 12:37, Marco Pivetta pisze: > Mixed includes null by definition. > > On Fri, 8 Feb 2019, 12:21 Robert Korulczyk wrote: > > > Without this, the mixed type-hint is basically meaningless noise, is it

Re: [PHP-DEV] Mixed type-hint

2019-02-08 Thread Marco Pivetta
Mixed includes null by definition. On Fri, 8 Feb 2019, 12:21 Robert Korulczyk > Without this, the mixed type-hint is basically meaningless noise, is it > > not? About as effective is a doc-block? > > This mixed type seems to be meaningless by design since its main goal is > to work the same as

Re: [PHP-DEV] Mixed type-hint

2019-02-08 Thread Robert Korulczyk
> Without this, the mixed type-hint is basically meaningless noise, is it > not? About as effective is a doc-block? This mixed type seems to be meaningless by design since its main goal is to work the same as if it was no type-hint at all... Another thing is that including null as part of mixed

[PHP-DEV] Mixed type-hint

2019-02-07 Thread Rasmus Schultz
Regarding the mixed type-hint RFC: https://wiki.php.net/rfc/mixed-typehint > When no native type is present, it is unclear what type is expected Regarding variance - in the examples shown in the RFC, it is still unclear whether your intention was variance, or if you just omitted the type-hint