Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92539 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35817 invoked from network); 20 Apr 2016 12:55:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Apr 2016 12:55:26 -0000 Authentication-Results: pb1.pair.com header.from=zeev@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=zeev@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 65.55.169.141 as permitted sender) X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 65.55.169.141 mail-bl2on0141.outbound.protection.outlook.com Received: from [65.55.169.141] ([65.55.169.141:62311] helo=na01-bl2-obe.outbound.protection.outlook.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DD/49-14036-C3C77175 for ; Wed, 20 Apr 2016 08:55:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=RWSoftware.onmicrosoft.com; s=selector1-zend-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=s94ABM//R0UIqr9tl4OzjQXU5aYMv3qibZ75BrSCnf4=; b=MvPFjXuP3jGIRQs9QgUh6HCoQr3wBxBRHjdbqyRVchfF/rNX6z9pVWtr5BnSpbiK0A+0Zjt3xtfFkIc7pzb/bFlweOHP4An4HNdlvZY/Pq/pRlNOhkL7X2P4uGhcjh/kRZ6q1SZjLxo9uB8+LrlZRhFEeN0hLDlute3x9jPdTww= Received: from BY2PR02MB298.namprd02.prod.outlook.com (10.141.140.21) by BY2PR02MB297.namprd02.prod.outlook.com (10.141.140.17) with Microsoft SMTP Server (TLS) id 15.1.466.19; Wed, 20 Apr 2016 12:55:20 +0000 Received: from BY2PR02MB298.namprd02.prod.outlook.com ([10.141.140.21]) by BY2PR02MB298.namprd02.prod.outlook.com ([10.141.140.21]) with mapi id 15.01.0466.022; Wed, 20 Apr 2016 12:55:19 +0000 To: Jesse Schalken CC: PHP internals Thread-Topic: [PHP-DEV] Re: Improving PHP's type system Thread-Index: AQHRlaUHEc+doe0x5E+u9VwQHuu4UJ+IRQcAgAANKICAAAFxgIAABh6AgAANpACAACnEH4AAm82AgAAMSgCAADMsgIAAVaeAgAASTYCAAVJIAIAHYpoAgAAekQCAAAbtgIAACnWggAASYQCAABDstQ== Date: Wed, 20 Apr 2016 12:55:19 +0000 Message-ID: <8D27A75B-E705-49E1-8ACD-B95E4DEDA383@zend.com> References: <570E99AC.3090804@fleshgrinder.com> <570EA5EB.8090501@fleshgrinder.com> <570EAB0D.6080706@gmail.com> <570EB67E.8010908@garfieldtech.com> <5B147E88-CC0A-4CBC-A49D-C7FE3BF557C0@zend.com> <6F.C3.12455.94C5F075@pb1.pair.com> <20160414094440.GF19347@phcomp.co.uk> <570FD94F.90703@fleshgrinder.com> <570FE8A9.4020809@gmail.com> <20.53.29891.17401175@pb1.pair.com> <1461145606.7556.11.camel@kuechenschabe> , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: jesseschalken.com; dkim=none (message not signed) header.d=none;jesseschalken.com; dmarc=none action=none header.from=zend.com; x-originating-ip: [212.199.177.67] x-ms-office365-filtering-correlation-id: a00f54f5-96ff-4bc1-1625-08d3691b0773 x-microsoft-exchange-diagnostics: 1;BY2PR02MB297;5:G61Y7b2zc8mnRS+Z0L9o46ZasRrZmgxkd5tfHP20PVMeP1LQnH6uo3HZHnPem2IAsPJaraSH1KihklcsV/Ei81IvVM25w8zG6mmUI3modDcShC5NVktQXwrViB8f0ZfIkycNJkrkIe5HW/aHNXlZMHkHaZCf0xRiPgoHSRm+/3H9tptBw0y03him/gIEg0S7;24:pkm5OWKE1IutGBZirgBjMHEX3AMltPaXZ8zEgkNz8mcXVzeNrnF2O3F0CjtYG97nwc7nx1O5h9kiI+zQT3ZSHTwX9nICTvE5WZChARFkwEI=;7:bv9YqrhlLHAxBDzh5MV4+S/IIFK50EsquEmvEXNhzjQOqRaFhUxB3fi+vckXFcC6GcenHYl2cYYOCoVwHQsO6MxUW7ki1cqUCn1meMTy3VOeygNHKOeW7g+ryCZPOBDcvTQh8Jp/YvjWIGK+TRAfQYEsBXV9V0ItZkybnsrPXhYHhU18vxVRMDUp2ixOJa15LZtkxVXhZVHCZpBFBcQfGsvSyWGzmKnACMOLbtKhRLA= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR02MB297; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(9101521026)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001);SRVR:BY2PR02MB297;BCL:0;PCL:0;RULEID:;SRVR:BY2PR02MB297; x-forefront-prvs: 0918748D70 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(24454002)(99286002)(2906002)(5002640100001)(5008740100001)(106116001)(2950100001)(87936001)(92566002)(66066001)(77096005)(36756003)(54356999)(82746002)(586003)(3846002)(6116002)(189998001)(16236675004)(10400500002)(4326007)(33656002)(5004730100002)(86362001)(110136002)(1096002)(19580395003)(19580405001)(76176999)(122556002)(83716003)(1220700001)(81166005)(93886004)(50986999)(102836003)(104396002);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR02MB297;H:BY2PR02MB298.namprd02.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: multipart/alternative; boundary="_000_8D27A75BE70549E18ACDB95E4DEDA383zendcom_" MIME-Version: 1.0 X-OriginatorOrg: zend.com X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Apr 2016 12:55:19.8450 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 32210298-c08b-4829-8097-6b12c025a892 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR02MB297 Subject: Re: [PHP-DEV] Re: Improving PHP's type system From: zeev@zend.com (Zeev Suraski) --_000_8D27A75BE70549E18ACDB95E4DEDA383zendcom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable On 20 ????? 2016, at 14:54, Jesse Schalken > wrote: If I had "scalar", "number" and ?T as types, the types I would need would b= e: 1. ?scalar|Decimal What's decimal? I'm not aware we have that type. Apologies if I missed it= that it was added. 1. ?scalar|Decimal|Expr What's Expr? Again I'm not aware that we have that type. In both, a nullable scalar does the job. 1. ?scalar|array Conduct this check in user code, you'd have to anyway. 1. int|string (I want int|string here. I know array keys are always int|= string. A wider type is lies.) This is needlessly purist. For handling a meaningless con, we'd overcompli= cate the language and provide a footgun(tm) for everyone. Not a good barga= in. 1. ?scalar (probably) Ok 1. number Ok 1. T|false You didn't answer my question on this one. 1. ?T Ok 5 out of 8 still need a union. Actually, in my count only one of them does (#7) and it's probably solvable= (if it's even a thing), and in another, it makes no sense to use types at = all (#3) as you'd have to do these checks in userland anyway. All others c= an be satisfied just fine with scalar, numeric and nullable types, unless y= ou're being needlessly purist - and we're not going to overcomplicate the l= anguage for the sake of purism. Zeev --_000_8D27A75BE70549E18ACDB95E4DEDA383zendcom_--