Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:116225 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 2530 invoked from network); 5 Oct 2021 13:24:01 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 5 Oct 2021 13:24:01 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A09DB1804C4 for ; Tue, 5 Oct 2021 07:08:29 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_05,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS29169 217.70.176.0/20 X-Spam-Virus: No X-Envelope-From: Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 5 Oct 2021 07:08:28 -0700 (PDT) Received: (Authenticated sender: come@chilliet.eu) by relay11.mail.gandi.net (Postfix) with ESMTPSA id F212110000C for ; Tue, 5 Oct 2021 14:08:26 +0000 (UTC) To: internals@lists.php.net Date: Tue, 05 Oct 2021 16:08:26 +0200 Message-ID: <4638866.snJnjoNyIA@tempete> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Subject: Re: [PHP-DEV] [RFC] Allow null as standalone type From: come@chilliet.eu (=?ISO-8859-1?Q?C=F4me?= Chilliet) Le lundi 4 octobre 2021, 10:09:12 CEST Nikita Popov a =C3=A9crit : > If we make this change, I would however suggest to also support "false" as > a standalone type. I think this change primarily has benefits from a > typesystem completeness perspective rather than a strong practical need. > From that angle, it would be nice if all types that are usable in a union > are also usable as standalone types, rather than shifting the special case > from null to false. It feels weird/wrong to slowly add values in the type system like this, rat= her than directly supporting static values as type hints. Why would function a(): null|false {} be legal but function b(): null|0 wou= ld not? This is inconsistent to me. And adding null, then false, then true for the = sake of completeness feels like avoiding to treat the static value as type = hint subject. C=C3=B4me