Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92814 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32611 invoked from network); 26 Apr 2016 19:14:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Apr 2016 19:14:09 -0000 Authentication-Results: pb1.pair.com header.from=bobwei9@hotmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=bobwei9@hotmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.com designates 65.55.111.107 as permitted sender) X-PHP-List-Original-Sender: bobwei9@hotmail.com X-Host-Fingerprint: 65.55.111.107 blu004-omc2s32.hotmail.com Received: from [65.55.111.107] ([65.55.111.107:52290] helo=BLU004-OMC2S32.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1C/59-20013-FFDBF175 for ; Tue, 26 Apr 2016 15:14:08 -0400 Received: from BLU436-SMTP142 ([65.55.111.71]) by BLU004-OMC2S32.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Tue, 26 Apr 2016 12:14:04 -0700 X-TMN: [r1H5ysLHSG90dfsaYiY3UD2bjsGncb25] X-Originating-Email: [bobwei9@hotmail.com] Message-ID: Content-Type: multipart/alternative; boundary="Apple-Mail=_8D8AE9BB-A401-4B68-BF5D-BCE8C24BB921" MIME-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) In-Reply-To: Date: Tue, 26 Apr 2016 21:13:59 +0200 CC: Levi Morrison , internals References: <571F7B91.2030102@zend.com> To: Niklas Keller X-Mailer: Apple Mail (2.3112) X-OriginalArrivalTime: 26 Apr 2016 19:14:01.0708 (UTC) FILETIME=[CAB16AC0:01D19FEF] Subject: Re: [PHP-DEV] [RFC] Patch for Union and Intersection Types From: bobwei9@hotmail.com (Bob Weinand) --Apple-Mail=_8D8AE9BB-A401-4B68-BF5D-BCE8C24BB921 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" > Am 26.04.2016 um 19:41 schrieb Niklas Keller : >=20 > 2016-04-26 19:33 GMT+02:00 Bob Weinand >: > > Am 26.04.2016 um 19:00 schrieb Niklas Keller >: > > > > 2016-04-26 16:58 GMT+02:00 Bob Weinand >: > > > >> 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. >=20 > 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. >=20 > 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. >=20 > 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? >=20 > I'd say it's special and doesn't have a type at all. No value, no = type. > =20 > 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. >=20 > If null doesn't have a type, it's clear that it can't be passed to a = function(Foo $foo) {}. There's undefined (=3D not a value) and there's the value null. We just = don't expose undefined to userland. [You see it when accessing undefined = variables, which PHP converts to null with a notice for example.] Null is definitely a value. You can pass it around, reflect on it, = assign it etc.. And as it is a value, it also has a type, which is null. Null is not special, it just has specific behavior, like any other = primitive type has. The only special thing is that it's allowed as a = default value with function (Foo $foo =3D null), but this should be = somewhen deprecated and removed once we have proper null unions. If you want to continue arguing, please open a new thread, but don't = side-track this thread to much, please. Bob= --Apple-Mail=_8D8AE9BB-A401-4B68-BF5D-BCE8C24BB921--