Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93506 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83850 invoked from network); 25 May 2016 14:56:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 May 2016 14:56:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; 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: dmitry@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:36906] helo=na01-bl2-obe.outbound.protection.outlook.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F1/B0-14311-E0DB5475 for ; Wed, 25 May 2016 10:56:15 -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=2iPXnd7y5UWEakzgemyYw0AV+alRvlT/SReYEGm6Dgg=; b=3JQh9VFdrvbGEDN4Yk5Wk5qL5ZoJzmc2CTqbxZRepGJ2N3y4lrbmzpgq52UooS24hQ8hq5DT+GNOK/KZnlDffh0CY23CTfnbbcX7w0R15Ha9sQ8kAeNvIu8hye+suH/y9GGQwsQi4hlq45K9VcIf2xo9UPIwd6vHDFhbowRA9EI= Received: from BY2PR0201MB1784.namprd02.prod.outlook.com (10.163.72.26) by BY2PR0201MB1784.namprd02.prod.outlook.com (10.163.72.26) with Microsoft SMTP Server (TLS) id 15.1.501.7; Wed, 25 May 2016 14:56:05 +0000 Received: from BY2PR0201MB1784.namprd02.prod.outlook.com ([10.163.72.26]) by BY2PR0201MB1784.namprd02.prod.outlook.com ([10.163.72.26]) with mapi id 15.01.0501.013; Wed, 25 May 2016 14:56:05 +0000 To: Joe Watkins , Nikita Popov CC: PHP internals , Phil Sturgeon , Bob Weinand Thread-Topic: [PHP-DEV] [RFC][Vote] Typed Properties Thread-Index: AQHRsl29xlQFrvOFJkSnB4pG0wOhsp/IclufgAC/7gCAAEMjgP//5SuAgABMNACAAAVSAIAAGDdG Date: Wed, 25 May 2016 14:56:04 +0000 Message-ID: References: , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: pthreads.org; dkim=none (message not signed) header.d=none;pthreads.org; dmarc=none action=none header.from=zend.com; x-originating-ip: [132.245.81.165] x-ms-office365-filtering-correlation-id: bfe18b72-989c-4ce7-92a4-08d384acb24d x-microsoft-exchange-diagnostics: 1;BY2PR0201MB1784;5:1zrktjgD1HiJwZ/l+4Oq2SnlxB+Tefz6Nk72Iu9BvfGzx6kVsD91bKkA3mddfpnZ3sczZM7At9z2SBGLXf3bX/1/MPF+j2qOfWsX0vPYv78MTIOhDoURYbCK96gOCgyT7UArpVXEkgX6q4MO6DInKw==;24:6OpP1JTZi4B6x2v00mEN64UGrDnvfXGZ8owaiRiyIgZ5zIpyYv2Ylf41ircYh58pVBQvY+wO7ikQngv0OtxZzbNORAm1ESMb51WCD4ejHCg=;7:xQlH2ijm6p8YvCx44L1oj+S2Crw+MmBH050iwikoRPPxx0uCRlwT5Tsa7FFKaYb8lMroSn7NkSGMeEfrkVNa6pdSw0IrCbpKZCihfXIZONhQ9XKeLciyWLJq70iOeEZN6SGfAnxPYSo18Ju6Wblbf6fIUExf8U+V5HM533q7MmXRk6MlbgyBXs2rJz7C1gTu x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0201MB1784; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001);SRVR:BY2PR0201MB1784;BCL:0;PCL:0;RULEID:;SRVR:BY2PR0201MB1784; x-forefront-prvs: 09538D3531 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(24454002)(52054003)(377454003)(3846002)(19627405001)(74316001)(102836003)(6116002)(2950100001)(76576001)(92566002)(2900100001)(9686002)(10400500002)(2906002)(5001770100001)(77096005)(4326007)(1220700001)(586003)(8676002)(8936002)(81166006)(16236675004)(5002640100001)(33656002)(5004730100002)(5003600100002)(19625215002)(5008740100001)(86362001)(106116001)(122556002)(50986999)(3660700001)(189998001)(3280700002)(11100500001)(66066001)(93886004)(76176999)(87936001)(19580395003)(19580405001)(54356999);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR0201MB1784;H:BY2PR0201MB1784.namprd02.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: multipart/alternative; boundary="_000_BY2PR0201MB1784E772EC4052E6453F2A5CBF400BY2PR0201MB1784_" MIME-Version: 1.0 X-OriginatorOrg: zend.com X-MS-Exchange-CrossTenant-originalarrivaltime: 25 May 2016 14:56:04.2124 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 32210298-c08b-4829-8097-6b12c025a892 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0201MB1784 Subject: Re: [PHP-DEV] [RFC][Vote] Typed Properties From: dmitry@zend.com (Dmitry Stogov) --_000_BY2PR0201MB1784E772EC4052E6453F2A5CBF400BY2PR0201MB1784_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I thought about a different approach :) - not-nullable typed properties must be explicitly initialized (or should b= e initialized implicitly by corresponding types, e.g. "int" should get defa= ult value int(0). ...) - nullable typed properties may be implicitly initialized by NULL (like unt= yped properties now). - unset() of typed properties should not be allowed This would allow to eliminate few weird run-time checks in VM and allow the= most efficient usage of type information in Optimizar and JIT. Thanks. Dmitry. ________________________________ From: Joe Watkins Sent: Wednesday, May 25, 2016 4:22:02 PM To: Nikita Popov Cc: Dmitry Stogov; PHP internals; Phil Sturgeon; Bob Weinand Subject: Re: [PHP-DEV] [RFC][Vote] Typed Properties Morning Nikita, That's pretty persuasive ... Dmitry, what are your thoughts on those points ? Cheers Joe On Wed, May 25, 2016 at 2:03 PM, Nikita Popov > wrote: On Wed, May 25, 2016 at 10:30 AM, Joe Watkins > wrote: Morning Dmitry, > I made this check(s) to be invariant. You may like to do this differently... I think this is what everyone expects, isn't it ? I did omit to mention that part ... > RFC doesn't define how uninitialized nullable typed properties should behave. It does: > *Nullable typed properties will not raise an exception when accessed before initialization.* I don't agree with this choice, for three reasons: a) This unnecessarily restricts what can be expressed in the type system. W= ith these semantics it will no longer be possible to express that a propert= y should be nullable, but have no default value. This situation is not unco= mmon in practice, in particular anytime you have a nullable constructor arg= ument, you will want the corresponding property to be nullable without a de= fault, to ensure that it is explicitly initialized. b) This directly contradicts the meaning of ?Type for parameters. For param= eters ?Type means that it's a nullable parameter **without a default value*= *. That's the very thing that distinguishes it from the Type $prop =3D null= syntax. And now ?Type for properties should mean the exact opposite? c) If you view this in a larger scope of union types, this *special case* b= ecomes even more weird. Why does the particular union Type|null get special= treatment, while all other unions don't? Or is it actually not specific to= "null", but to single value types? E.g. if we also allowed Type|false, wou= ld that also receive an implicit false default value? What about the type n= ull|false? Does that get an implicit default, and if so, which? I realize t= his is not quite in scope for type properties, but the further evolution of= the type system should be kept in mind. Please keep things consistent: If there is not default, there is no default= . Nikita --_000_BY2PR0201MB1784E772EC4052E6453F2A5CBF400BY2PR0201MB1784_--