Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101437 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9213 invoked from network); 29 Dec 2017 14:20:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Dec 2017 14:20:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=php-lists@koalephant.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=php-lists@koalephant.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain koalephant.com designates 206.123.115.54 as permitted sender) X-PHP-List-Original-Sender: php-lists@koalephant.com X-Host-Fingerprint: 206.123.115.54 mail1.25mail.st Received: from [206.123.115.54] ([206.123.115.54:35260] helo=mail1.25mail.st) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E5/19-47595-D2F464A5 for ; Fri, 29 Dec 2017 09:20:29 -0500 Received: from [10.0.1.27] (unknown [49.48.243.158]) by mail1.25mail.st (Postfix) with ESMTPSA id 0917A60467; Fri, 29 Dec 2017 14:20:18 +0000 (UTC) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) X-Mailer: iPhone Mail (15C153) In-Reply-To: Date: Fri, 29 Dec 2017 21:20:14 +0700 Cc: Rowan Collins Content-Transfer-Encoding: quoted-printable Message-ID: <69D86823-589C-41D7-9A3E-D6CB4A58D5A2@koalephant.com> References: <72392123-d37b-26df-6886-218f48205f8a@fleshgrinder.com> <58A5ABDF-AA25-46D4-83E7-4DE72E3DFF5E@gmail.com> <757270790.33iDQ9MZ2V@vulcan> <737D892F-BF1C-4A6E-9833-BEF050C78274@gmail.com> To: internals@lists.php.net, php@fleshgrinder.com Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Scalar Pseudo-type From: php-lists@koalephant.com (Stephen Reay) > On 29 Dec 2017, at 19:56, Fleshgrinder wrote: >=20 >> On 12/29/2017 1:26 PM, Rowan Collins wrote: >> On 29 December 2017 12:08:16 GMT+00:00, Fleshgrinder >> wrote: >>> What is the use case for `int|float`? I mean, if f is able to >>> process a `float` than f is able to process an `int` and since >>> `int` is already automatically changed to a `float`, well, you're >>> done. >>=20 >> I think it is somewhat tedious if we discuss every possible pair of >> types, just as it would be somewhat messy if we added a new keyword >> for every combination we found a use case for. The beauty of a >> general-purpose syntax is precisely that a user can use whatever >> combination they need, and not use combinations they don't need. I'm >> sure there are plenty of nonsensical or redundant checks that can be >> expressed in other parts of the language, but that doesn't mean those >> language constructs are useless or damaging. >>=20 >> Regards, >>=20 >=20 > I agree and I do not intend to do so, I actually am not even questioning > the usefulness of union and intersection types. I am more curious in > regards to providing a `number` type. Seems useless to me. >=20 > --=20 > Richard "Fleshgrinder" Fussenegger >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20 I'm not sure "number" as a predefined type union is necessary but int|float w= ould allow a method to accept either in strict mode, and as you said it woul= d also be useful for eg a formatting function.=