Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102354 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92310 invoked from network); 21 Jun 2018 16:27:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jun 2018 16:27:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=bobwei9@hotmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=bobwei9@hotmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hotmail.com designates 40.92.69.27 as permitted sender) X-PHP-List-Original-Sender: bobwei9@hotmail.com X-Host-Fingerprint: 40.92.69.27 mail-oln040092069027.outbound.protection.outlook.com Received: from [40.92.69.27] ([40.92.69.27:4016] helo=EUR02-VE1-obe.outbound.protection.outlook.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0B/34-32156-5E1DB2B5 for ; Thu, 21 Jun 2018 12:27:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I14nac5SiLlfm6Vcz8OC1kT4jbxmbNgmV+q3OK6/4Mg=; b=KnnRGHct08vCEV1oa9lPrymNKTHlxcY8dMcOCimeBsIJ+Ho9UjAlm3/bWEE5kbBkJhquOpm3L0zkvikygIdzW5RyVDeiYLHtbQKNSMhoggmSXn+ZZ4DGB19SnoMEEnWRxv28z4/L7bxjb8GR1XyjGvPQwU+F2aOLgSLSYZ1HGIpBbnJ5MlOQYu7XCEIwZs0b1aNb3yZOmjYyUoT/kuNutEl0Nt/437ipXB/Vm9gcfkXSBPEEx+qjtOswbcqnJCOsYAB/E4xnJmzSB4J3kPiM+H8LEe/s32F6MzV9UHbGJ4stJkXfZQLrYMItjwK1EykOWojmHXiVmxMB+Ev0gEtzPA== Received: from AM5EUR02FT051.eop-EUR02.prod.protection.outlook.com (10.152.8.56) by AM5EUR02HT052.eop-EUR02.prod.protection.outlook.com (10.152.9.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.884.17; Thu, 21 Jun 2018 16:27:14 +0000 Received: from AM0PR0702MB3684.eurprd07.prod.outlook.com (10.152.8.57) by AM5EUR02FT051.mail.protection.outlook.com (10.152.9.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.20.884.17 via Frontend Transport; Thu, 21 Jun 2018 16:27:14 +0000 Received: from AM0PR0702MB3684.eurprd07.prod.outlook.com ([fe80::24b9:487b:fff5:4af8]) by AM0PR0702MB3684.eurprd07.prod.outlook.com ([fe80::24b9:487b:fff5:4af8%5]) with mapi id 15.20.0906.010; Thu, 21 Jun 2018 16:27:14 +0000 To: 'Larry Garfield' CC: "internals@lists.php.net" Thread-Topic: [PHP-DEV] [RFC] Typed Properties Thread-Index: AQHUCOIIhp4usNXUXkaaqOKHqjjlbaRq5LIAgAAC9YA= Date: Thu, 21 Jun 2018 16:27:14 +0000 Message-ID: References: <1881440.OZkolYVza1@vulcan> In-Reply-To: <1881440.OZkolYVza1@vulcan> Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM6PR03CA0026.eurprd03.prod.outlook.com (2603:10a6:20b::39) To AM0PR0702MB3684.eurprd07.prod.outlook.com (2603:10a6:208:26::13) x-incomingtopheadermarker: OriginalChecksum:1AD6600A9D7ECBBDB7D9421F4E3A86532A3E5BA29A51F892072D2526DE19C633;UpperCasedChecksum:21F7F745E3CA03076AD86D32ACC04D9433E12797539A5CA298472CAC7D3C81B2;SizeAsReceived:7514;Count:50 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [TeoeGZA6nGolkHPWPA6bm9B9WzsNfdO0TJ5cmEeRDUWT3KIFOraMqg20MTBcsDlB] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;AM5EUR02HT052;7:wfjmg4M1ineFfh6t6JpIAMRFIUFa/I7jaDSDxY+8dTDq+qKstzel8qkBT9yqPCWbFxaUS8NvZUDLRr28LOvB/ko8knxlLvG/c6XMX8EhWl0040mlsswFkvtlKJnGkLCvzbT0Xk3NN/+03UvaHY7Wje386iF/9ed4tBTZeJqfqjoPZidlUhojyJ61nqx1G7P12T2kLn38ijzgaZsv1Cku0InY9Gqp+kswUvjKr8AAgbmUzPhJQJLK8/85Brh+AdV/ x-incomingheadercount: 50 x-eopattributedmessage: 0 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322404)(1603101448)(1601125500)(1701031045);SRVR:AM5EUR02HT052; x-ms-traffictypediagnostic: AM5EUR02HT052: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(444000031);SRVR:AM5EUR02HT052;BCL:0;PCL:0;RULEID:;SRVR:AM5EUR02HT052; x-forefront-prvs: 07106EF9B9 x-forefront-antispam-report: SFV:NSPM;SFS:(7070007)(189003)(199004)(5250100002)(81156014)(476003)(25786009)(6916009)(5660300001)(68736007)(8676002)(305945005)(102836004)(6346003)(97736004)(486006)(87572001)(20460500001)(104016004)(74316002)(11346002)(229853002)(6436002)(4326008)(446003)(82202002)(105586002)(6246003)(86362001)(7696005)(76176011)(73972006)(53546011)(106356001)(6506007)(2900100001)(14454004)(83332001)(55016002)(33656002)(8936002)(99286004)(3280700002)(46003)(386003)(3660700001)(9686003)(15852004);DIR:OUT;SFP:1901;SCL:1;SRVR:AM5EUR02HT052;H:AM0PR0702MB3684.eurprd07.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:; received-spf: None (protection.outlook.com: hotmail.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=bobwei9@hotmail.com; x-microsoft-antispam-message-info: idvzq5zFxwvxEqElXhCndHCSDt902z5q6tW6nWbrSRnIfu7v0DKuUsVceNfYcWHk2hjgul64Jwmw7n5Mr+YQhXn57/Pu1ijAEkxv5V1hpT1eXsTePrVWQUJGWG7sqdzNVovlNiBdZd0GbacyfN/V9J4zr+zgpoL2Cpbrxmz0fKblNS1MklaS7wmAD+rGPSaG Content-Type: text/plain; charset="us-ascii" Content-ID: <3EFE44CDB5180E41B560652CD2F0D2F0@eurprd07.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 54485d23-c432-40fe-8436-6091d627118c X-MS-Exchange-CrossTenant-Network-Message-Id: fb0c0f0e-089c-47b0-4f4f-08d5d793d8b2 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 54485d23-c432-40fe-8436-6091d627118c X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jun 2018 16:27:14.5156 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5EUR02HT052 Subject: RE: [PHP-DEV] [RFC] Typed Properties From: bobwei9@hotmail.com (Bob Weinand) Hey Larry, > From: Larry Garfield > Sent: Thursday, June 21, 2018 18:17 > To: internals@lists.php.net > Subject: Re: [PHP-DEV] [RFC] Typed Properties > Questions along the way: >=20 > * There was at one point in time a related RFC regarding property accessors > (dedicated getter/setter methods for each property that get called > automatically). That was rejected largely on performance grounds at the > time. > Would this RFC 1) Hinder returning to property accessors in the future 2) Help > resolve some of the issues there indirectly 3) Have no effect on the viability > of accessors? I don't think it'll hinder them, accessors are pretty orthogonal to this feature. Sure they'll have to cast the returned value according to the property type, but that's no different than a return type and just like __get() works in this RFC. But that's already about the complete impact. An accessor ultimately isn't really any more expensive than a __get() call at a fundamental level. > * How much compile time detection is possible? Eg, the following code > would clearly never work: >=20 > class Foo { > protected int $val; >=20 > public function setVal(string $val) : void { > $this->val =3D $val; > } >=20 > public function getVal() : string { > return $this->val; > } > } >=20 > (I suppose technically it might work in coercive mode, but not strict mode?) > Would this be a compile time error, or a runtime error when you first try to > run it? (I'm assuming IDE linters would be able to catch it, but if the engine > could too that's even better.) PHP core generally does no type analysis at all at compile-time. Any type analysis is happening in opcache/Optimizer and until now opache/Optimizer hasn't chosen to warn if it encounters impossible conditions. This may or may not change in future, but isn't related here. So it is a runtime error; any other behavior would be out of scope of this RFC. Bob