Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101430 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66030 invoked from network); 28 Dec 2017 23:21:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Dec 2017 23:21:38 -0000 Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 66.111.4.26 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 66.111.4.26 out2-smtp.messagingengine.com Received: from [66.111.4.26] ([66.111.4.26:50989] helo=out2-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E0/C5-47595-08C754A5 for ; Thu, 28 Dec 2017 18:21:37 -0500 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 9363321B4F for ; Thu, 28 Dec 2017 18:21:33 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Thu, 28 Dec 2017 18:21:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=Wj7iQroChmp+PRuZt/bRWt5bu6Vfa Piz61I+L/H0Gd0=; b=SamAm5ZAEt+1dza6TfVSo/aEnPWK4vypV9jVtL6IJ/Ewd ITXahhpRtxDZ50B/HQgLGpGnU3b1Zpoo5R/aCSplGBtpt21Mua1wf5+KmHHsV6eS 3XTN008s8o3NOUEYDbFOJJNffb4hERi50UlO2BkRv+5SWdwcrZ82Gna74tqEE+OK io4aPCCwWAtC2bvh/LCB4/7zJh2j1XnBjB+XJcKU5p6aQNxhj539yb5rhv+WqXC9 UwAYwDpzgvh8LF+kDy7HjnvimuufVfGe2fDOOqzkZIWq+GxHFCdkoSXgojeI6uvz qtPkjbmxGMtzVfS3G3UEImXNGeJupZbvDCwhC5f6g== X-ME-Sender: Received: from vulcan.localnet (216-80-30-152.s3222.c3-0.frg-ubr1.chi-frg.il.cable.rcncustomer.com [216.80.30.152]) by mail.messagingengine.com (Postfix) with ESMTPA id 59214240DB for ; Thu, 28 Dec 2017 18:21:33 -0500 (EST) To: internals@lists.php.net Date: Thu, 28 Dec 2017 17:21:28 -0600 Message-ID: <757270790.33iDQ9MZ2V@vulcan> In-Reply-To: <58A5ABDF-AA25-46D4-83E7-4DE72E3DFF5E@gmail.com> References: <72392123-d37b-26df-6886-218f48205f8a@fleshgrinder.com> <58A5ABDF-AA25-46D4-83E7-4DE72E3DFF5E@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart3492777.bSyWR4tHvo"; micalg="pgp-sha256"; protocol="application/pgp-signature" Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Scalar Pseudo-type From: larry@garfieldtech.com (Larry Garfield) --nextPart3492777.bSyWR4tHvo Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" On Wednesday, December 27, 2017 3:50:54 AM CST Rowan Collins wrote: > On 26 December 2017 18:35:29 GMT+00:00, "lists@rhsoft.net" wrote: > >Am 26.12.2017 um 19:18 schrieb Larry Garfield: > >> If I may, I think the argument has always been that > >> > >> 1) Foo & Bar makes total sense > >> 2) int|float makes total sense > >> 3) int & string is illogical so wouldn't matter anyway > > > >not true > > > >function x(int|string $x) > >{ > > > > $x = (int)$x; > > > >} > > I think there's a misunderstanding here. Some previous proposals for "union > types" also included "intersection types", so that you could assert > "parameter must implement both of these interfaces". So 'Foo|Bar $x' would > mean '$x instanceof Foo || $x instanceof Bar' and 'Foo&Bar $x' would mean > '$x instanceof Foo && $x instanceof Bar'. > > I presume that's what Larry means by "int & string is illogical", because it > would translate to "is_int($x) && is_string($x)", which is false for all > values of $x. This is different from "int | string", which, as you say, > might have valid uses. > > Regards, Correct. Union types I've always seen presented as offering both union and intersection. There are cases where union is great, and where it's kinda silly. There are cases where intersect is great, and where it's kinda silly. Most of the anti- arguments I've seen for "union types" have fixated on "int && string is meaningless, and Foo || Bar is bad design, so union types are bad!" Entirely ignoring the flip side, which is int || string (valid use cases) and Foo && Bar (many many valid use cases). --Larry Garfield --nextPart3492777.bSyWR4tHvo Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQEcBAABCAAGBQJaRXx4AAoJEODDCsAxcWF3UDEIAM6Q4ngxMApcUT46gPhRzmxU XwG5+o3ykqfLIxBPJdVsd78tNnBvgWp0yJG7wmnplxQmGLIfArj1wJF5/IlwTCBy IEIuqf2SaHV2wuJh4DKQY2eBafwfdIK0QXClWqChKH0mPndB/FL4JFHr5txWWoMo vL3u9FAtNln1SRKR3geUjJANu9/mi4ejTPMdb4SJN/XjovkjgcEeWEVyg2X3SG/W PWI7pjoNfGzJSDiajlDqvDrRD32s06gxQAPwp0Q779jCyNfKv7YDcTdanG82C3Vw U5UV0rEp/wLPMxTTdGIfYbgDM5U3MiOJatWMN0+GY9APIFDoZQM7nb0DXJaUq7A= =lkIm -----END PGP SIGNATURE----- --nextPart3492777.bSyWR4tHvo--