Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91999 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45681 invoked from network); 29 Mar 2016 22:59:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Mar 2016 22:59:21 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 157.56.110.114 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 157.56.110.114 mail-bn1on0114.outbound.protection.outlook.com Received: from [157.56.110.114] ([157.56.110.114:44012] helo=na01-bn1-obe.outbound.protection.outlook.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E1/F9-24137-5C80BF65 for ; Tue, 29 Mar 2016 17:59:18 -0500 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=WMsggi7fXLvoUz48EK+J+WuDs+A+b/jeppAgFtEsR1U=; b=7N/lYx9jdkIzMYHc29zCHpzmM6AWfgBybGfnLwgnx0NR5P2mmuSeOwEfqpDa6+t8YIVo3ZZ+PkhihIR9IhZ2CxlUnjjtUBey8a76mvZqiDzvCktQri/B13frz5bXwU/YD+J1G58Z/fP3FquJXZdtO+5qjzWU+xrbEN8G6I/96ec= Received: from CY1PR0201MB1786.namprd02.prod.outlook.com (10.163.55.19) by CY1PR0201MB1788.namprd02.prod.outlook.com (10.163.55.21) with Microsoft SMTP Server (TLS) id 15.1.443.12; Tue, 29 Mar 2016 22:59:14 +0000 Received: from CY1PR0201MB1786.namprd02.prod.outlook.com ([10.163.55.19]) by CY1PR0201MB1786.namprd02.prod.outlook.com ([10.163.55.19]) with mapi id 15.01.0447.023; Tue, 29 Mar 2016 22:59:13 +0000 To: Joe Watkins CC: Phil Sturgeon , "krakjoe@php.net" , "internals@lists.php.net" Thread-Topic: [PHP-DEV] [RFC Discussion] Typed Properties Thread-Index: AQHRf6IoPDUZe6dKO0uOqXcCfmmOFZ9cVmwAgAAC8ICAAAQ6gIAAArwAgAAHWICAAdLfgIAF1WiAgAAYowCAAVH4AIAAHmmAgAABaICAAEfhgIAAIEOAgAqejYCAAAhCX4AABJQAgAABThyAAFY2Ig== Date: Tue, 29 Mar 2016 22:59:13 +0000 Message-ID: References: <1458149992.3969.2.camel@kuechenschabe> <1458151531.3969.8.camel@kuechenschabe> <1458153695.3969.16.camel@kuechenschabe> <3F.70.02405.6803BE65@pb1.pair.com> <56F01545.8080008@gmail.com> <56F14572.701@gmail.com> <56F15EF5.80006@telia.com> <56F16023.1010002@gmail.com> ,, In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=zend.com; x-originating-ip: [132.245.81.165] x-ms-office365-filtering-correlation-id: 1b06ee96-9dc1-46ec-92f2-08d35825bf7a x-microsoft-exchange-diagnostics: 1;CY1PR0201MB1788;5:zHHtEOW7+KzgwdjdtTEeopLDO+qm3chj1zL6EW4DB+I576tFoYpAM+t1/jKAhbqprhLjH1pXiCPoAh/v4qgkJTWLcMIJl1nWpQtwrmXCrcSSQsE5RrNcRiitimHnnDYaST/Yn59t7EcJ1+Z3fFG8NA==;24:niInoWgjgOWCmWVFrNzszvFxcE71ImyjkU6oQR6nxaBI35NCW1uGZSJAfDd35J9ewCsjX0kuk6bSKlpvvB9gGH5rY7SoNTUKGtpln0ArTnc= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0201MB1788; 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:CY1PR0201MB1788;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0201MB1788; x-forefront-prvs: 0896BFCE6C x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(24454002)(43544003)(377454003)(87936001)(93886004)(15188155005)(92566002)(5008740100001)(76576001)(122556002)(99286002)(5004730100002)(3846002)(86362001)(81166005)(1220700001)(16799955002)(102836003)(74316001)(6116002)(33656002)(1096002)(189998001)(586003)(3660700001)(110136002)(3280700002)(2906002)(5002640100001)(3900700001)(4326007)(19580395003)(19580405001)(66066001)(50986999)(76176999)(10400500002)(54356999)(2900100001)(15975445007)(5003600100002)(106116001)(77096005)(2950100001)(556834003);DIR:OUT;SFP:1102;SCL:1;SRVR:CY1PR0201MB1788;H:CY1PR0201MB1786.namprd02.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:23 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: zend.com X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Mar 2016 22:59:13.5444 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 32210298-c08b-4829-8097-6b12c025a892 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0201MB1788 Subject: Re: [PHP-DEV] [RFC Discussion] Typed Properties From: dmitry@zend.com (Dmitry Stogov) Hi, Reviewing the patch sources I found few inconsistent decisions not mentione= d in RFC.=20 1) static typed properties are prohibited. why? 2) The handling of multiple properties in the same declaration statement is= inconsistent. public int $bar, string $qux; // this works public int $bar, $qux; //this emits error: Untyped property A::$qux must n= ot be mixed with typed properties It's better to allow type only before first property in the list and apply = them to all of them (like C, Java and others). Is this just an implementation issue? 3) We already have nullable arguments without any special syntax. We should= reuse the similar approach for properties. public int $num =3D null; 4) There's a mess with initialization of typed properties. (typed propertie= s are initialized by IS_UNDEF, untyped by IS_NULL). I think it might be better to implicitly initialize them according to type = (if default value is not provided): bool by false, int by 0, double by 0.0,= string by "" (interned), array by [] (immutable), objects by NULL (always = nullable). Also I found a number of implementation problems: 5) We can't change property_info->type_ce for internal properties, because = they are shared between threads. Can property of Internal class have a type of user class? This would lead t= o crash on second request. 6) $x->a++; doesn't throw on overflow 7) ++$a->a; and +=3D throw on overflow, but change the property value to "f= loat" 8) Reference handling in ZEND_FETCH_OBJ_W is not robust. At least, EXT_NOP = or TICK may be inserted before next ASSIGN_REF. Handling of ZEND_ADD_ARRAY_= ELEMENT and ZEND_YIELD is too pessimistic, missing support for SEND_REF and= may be others. 9) Often calls to zend_object_fetch_property_type_info() are not good for p= erformance. Currently FETCH_OBJ_X cache "offset" to property, in general we= may go back and cache address of "property_info", but this is going to dec= rease performance for each property access. It would be great to find a be= tter solution. May be using zval.reserved. I assume, I didn't find all problems yet. I think, both RFC and implementation have problems. I may try to help with implementation. (9) is the most difficult problem, and I'll try to solve it first. Do you see any problems with updating RFC with (2), (3), (4)? (1) would also make proposal more consistent, but I assume you got some tro= ubles implementing it and I don't know about them yet. Thanks. Dmitry. ________________________________________ From: Dmitry Stogov Sent: Tuesday, March 29, 2016 19:24 To: Joe Watkins Cc: Phil Sturgeon; krakjoe@php.net; internals@lists.php.net Subject: Re: [PHP-DEV] [RFC Discussion] Typed Properties Thanks. I'll start tomorrow morning and will try to send you update by the = evening, ________________________________ From: Joe Watkins Sent: Tuesday, March 29, 2016 19:18 To: Dmitry Stogov Cc: Phil Sturgeon; krakjoe@php.net; internals@lists.php.net Subject: Re: [PHP-DEV] [RFC Discussion] Typed Properties Hi Dmitry, The patch is pretty close to complete. When you start to dig a bit further, you'll notice that I prepared for = using cached pointers to prop info, but, I'm not sure how to allocate those= as the handlers are using the currently allocated slots so differently. I also patched opcache, but it's probably wrong (or not good enough, no= t sure what to do about type_ce). Please do start working on the patch, that would be great ... I'll leav= e it alone for you to do your thing :) Cheers Joe On Tue, Mar 29, 2016 at 5:12 PM, Dmitry Stogov > wrote: Hi Phil, hi Joe, Is your patch complete? I took just a brief review yet, and I would like to make a deep check once = again (and may be optimization). I saw, the patch makes some slowdown, but less than I expected. If you are not going to modify the patch in next two days, I would start wo= rking on it tomorrow. RFC itself looks fine. Thanks. Dmitry. ________________________________________ From: Phil Sturgeon > Sent: Tuesday, March 29, 2016 18:32 To: Andrey Andreev Cc: internals@lists.php.net Subject: Re: [PHP-DEV] [RFC Discussion] Typed Properties I'd like to thank everyone for their feedback on this RFC! It looks like the majority of concerns were solved during the course of this discussion, which is great news. The RFC has been expanded in a few areas to take care of a few other concerns, so please go and review it and let me know if you have any feedback. https://wiki.php.net/rfc/typed-properties Voting will start in a few days. Cheers, Phil -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php