2016-04-26 19:33 GMT+02:00 Bob Weinand <bobw...@hotmail.com>:

> > Am 26.04.2016 um 19:00 schrieb Niklas Keller <m...@kelunik.com>:
> >
> > 2016-04-26 16:58 GMT+02:00 Bob Weinand <bobw...@hotmail.com>:
> >
> >> Yeah, I'd like to not allow ?Foo in any case if union types pass.
> >>
> >
> > What's the reason for that? To me, null is neither a type nor should it
> be.
>
> I don't want to argue that now, but null most definitely IS a type. It is
> the null type with a single value, null, whose semantics is to represent
> the absence of any other value.
>
> There's also plenty of evidence in PHP that null is considered a type:
> get_type(), https://php.net/null, has it's own is_* function etc.
> At least in the PHP ecosystem it is considered its own type. Other type
> systems may not, but the one of PHP does.
>
> Thus, we are definitely considering it as a type - a question for you:
> What's the type of the value null then, if not null?
>

I'd say it's special and doesn't have a type at all. No value, no type.


> If we wouldn't make a distinction between null and an object (i.e. allow
> null to be passed to a function(Foo $foo) {}), it could be considered a
> supervalue of type object. But that's not the case.


If null doesn't have a type, it's clear that it can't be passed to a
function(Foo $foo) {}.

Reply via email to